Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5644655
  • 博文数量: 291
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 7924
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-06 14:28
个人简介

阿里巴巴是个快乐的青年

文章分类

全部博文(291)

文章存档

2018年(21)

2017年(4)

2016年(5)

2015年(17)

2014年(68)

2013年(174)

2012年(2)

分类: LINUX

2017-04-12 20:09:40

1.从远程仓库下载代码到本地
#git clone
#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  #删除本地分支
#git push origin --delete newBranch #删除远程分支

13.删除文件
#git rm xxx

14.恢复被删除文件
#git reset HEAD xxx
#git checkout -- xxx

15.查看仓库地址
#git remote -v

16.子模块引入    #更多信息参见这里
#git submodule add git@xxx.submodule.git test    #添加子模块
#git status    #父模块多了test目录和.gitmodules文件
#git commit -m "test submodule"
#git push origin master
#cd test    #进入子模块目录
#git status    #查看子模块新增状态
#git add .
#git commit -m "update submodule"
#git push    #将submodule改动提交到远程服务器
#cd ..
#git status
#git push    #将submodule变动提交到远程服务器
#git submodule update --init --recursive    #初始化本地配置文件,pull子模块代码到本地


更多信息请参考这里


阅读(3412) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~