您的位置:首页 > 运维架构 > Shell

gitbash的使用,本地建feature branch

2017-02-03 12:06 204 查看
Clone 到本地

1. 创建新文件夹, $ git clone (不要在这一级文件夹git init或右键git bash here)

2. 点击进入克隆好的文件夹,右键git bash here开始工作

push到origin(自己的远端)

$ git status 查看自己local XXbranch 和Origin XXbranch的区别

$ git add . 添加全部变动

$ git commit -s -m “closes #2” commit并添加备注

$ git push 确认push

在local feature branch修改 并push到team repository

1. 网页操作新建feature branch 新建的是origin的branch

2. $ git fetch 是origin上新建的feature branch生成local对应的feature branch

3. $ git checkout 跳转到本地的feature branch,开始进行代码部分工作

4. $ git push -u origin Local feature branch完成改动后,push到自己远端origin 对应的feature branch 上。

5. 从origin的feature branch上向team repository的默认branch(develop branch)申请PR来merge

6. $ git pull upstream develop Merge通过后,将upstream(default branch)pull到local develop branch

7. $ git status 这个时候,local develop branch 应该比origin develop branch 领先几个commits

8. $ git add . 将与team repository同步的local develop branch push到origin develop branch

9. $ git commit -s -m “comment here”

10. 创建下一个feature branch As above

备注:

• 能否merge那一页,看的是team和origin的差别(自己的远端),而不是local

• 取回origin主机的next分支,与本地的master分支合并,需要写成下面这样: $ git pull origin next:master

• 如果远程分支是与当前分支合并,则冒号后面的部分可以省略: $ git pull origin next

• 添加upstream关键字: git remote add upstream
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git gitbash branch github