码迷,mamicode.com
首页 > 其他好文 > 详细

【git】git常用命令

时间:2019-03-26 01:27:22      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:exe   hello   页面   dir   push   设置   ini   .com   状态   

1、$ sudo apt-get install -y git #安装
2、$ git --version #查看版本
3、$ sudo mkdir git_exercise 
   $ sudo git init #初始化仓库
4、$ git status #是否为最新代码,有什么更新等
5、$ git add hello.txt #添加到暂存区,用于commit
   $git add -A   #提交目录下的所有
6、$ sudo git config --global user.name "ndz" 
   $ sudo git config --global user.email "535704264@qq.com"  #设置用户及邮箱
7、$ sudo git commit -m "Initial commit" #提交并添加描述信息
8、$ sudo git remote add origin https://gitee.com/voider_ni/hello  #将本地仓库链接到远程项目,一个项目可以同时拥有好几个远程仓库,主要的称为 origin ,注意远程仓库仅仅创建即可,不要在页面提交任何东西
  8.1 $ sudo git remote rm origin  
9、$ git push origin master #从本地上传到远程服务器
10、$ git pull origin master #从远程服务器获取更新
11、$ sudo git branch new_branch #创建新的分支
12、$ git branch #查看分支状态
13、$ git checkout new_branch #切换分支
14、$ sudo git merge new_branch #将 new_branch 合并到master
15、$ git branch -d new_branch  #删除new_branch分支

【git】git常用命令

标签:exe   hello   页面   dir   push   设置   ini   .com   状态   

原文地址:https://www.cnblogs.com/jzsg/p/10597654.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!