从您创建拉取请求的分支(例如,pr-branch
)创建新分支(例如,feature
)。
$ git checkout pr-branch # checkout to 'pr-branch'
$ git checkout -b feature # create and checkout to 'feature' branch
然后,当你与feature
分公司完成,合并feature
分支与pr-branch
。现在
$ git push origin feature # push 'feature' branch changes to remote
$ git checkout pr-branch # checkout to 'pr-branch'
$ git pull origin feature # pull 'feature' branch changes into local 'pr-branch'
$ git push origin pr-branch # update remote 'pr-branch'
,你对REPO
PR应自动自从与feature
分支提交pr-branch
更新/修改更新。从另一台计算机
如果您对feature
分支,然后两台电脑和工作之间切换,只需推您的最新feature
了变化,远程和拉开始从最新的代码工作。
# computer-1
$ git pull origin feature
# do some commits here...
$ git push origin feature
# computer-2
$ git pull origin feature
# start working from latest codes and do commit...
$ git push origin feature
在你将代码从'feature'移动到'pr-branch'的部分结束时,你不应该'push'回推'origin'的'pr-branch'吗? – 3D1T0R
@ 3D1T0R,是的,谢谢! –