分类: LINUX
1.从远程仓库下载代码到本地
#git clone http://gitlab.xxx.com/xxx.git
# git clone git@gitlab.xxx.com/xxx.git
2.查看分支
#git branch
#git branch -r #查看远程分支
#git branch -a #查看所有分支
3.创建分支
#git checkout -b newBranch
4.切换分支
#git checkout master
#git checkout newBranch
5.查看分支状态
#git status
6.查看分支差异
#git diff
7.提交代码到暂存区
#git add .
#git add xxx
8.提交代码到当前分支
#git commit -m "support xxx"
9.提交代码到远程仓库
#git push origin newBranch
10.更新仓库代码到本地
#git pull origin newBranch
11.合并分支
#git checkout master #切换到master
#git merge newBranch #合并分支newBranch到主干master
12.删除分支
#git branch -D newBranch
13.删除文件
#git rm xxx
14.恢复被删除文件
#git reset HEAD xxx
#git checkout -- xxx
更多信息请参考 这里。
#git clone http://gitlab.xxx.com/xxx.git
# git clone git@gitlab.xxx.com/xxx.git
2.查看分支
#git branch
#git branch -r #查看远程分支
#git branch -a #查看所有分支
3.创建分支
#git checkout -b newBranch
4.切换分支
#git checkout master
#git checkout newBranch
5.查看分支状态
#git status
6.查看分支差异
#git diff
7.提交代码到暂存区
#git add .
#git add xxx
8.提交代码到当前分支
#git commit -m "support xxx"
9.提交代码到远程仓库
#git push origin newBranch
10.更新仓库代码到本地
#git pull origin newBranch
11.合并分支
#git checkout master #切换到master
#git merge newBranch #合并分支newBranch到主干master
12.删除分支
#git branch -D newBranch
13.删除文件
#git rm xxx
14.恢复被删除文件
#git reset HEAD xxx
#git checkout -- xxx
更多信息请参考 这里。