Git/Github - 签出当前远程分支的正确方法
我们使用一个简单的 Github 流程,其中远程 Github 存储库具有 Master(用于生产)和 Develop(用于开发)。
我想从开发(远程)中签出分支并将我的更改合并回开发(远程)中。
从开发(远程)检出新分支以便我知道我拥有该分支的当前远程状态的正确方法是什么?
- 作为参考,我正在尝试使用此流程 http://nvie.com/ posts/a-successful-git-branching-model/ 。也许我应该修改
$ git checkout -b myfeaturedevelopment
从 origin/develop 签出?
非常感谢!
We are using a simple Github flow where the remote Github repository has Master (for production) and Develop (for development).
I want to checkout branches from Develop (remote) and merge my changes back into Develop (remote).
What's the proper way to checkout a new branch from Develop (remote) so that I know I have the current remote status of the branch?
- for reference I'm trying to use this flow http://nvie.com/posts/a-successful-git-branching-model/ . Perhaps I should just modify
$ git checkout -b myfeature develop
to checkout from origin/develop?
Thanks much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用 更新远程跟踪分支
更新您的本地开发分支
然后您使用或
然后使用最新的开发来制作您的功能:
使用 git log 进行双重检查:
您应该看到提交以及开发、起源/开发、myfeature 和HEAD 都指向同一件事。您现在可以在新分支中工作,并且该工作将是您提取时的最新工作。
you update the remote tracking branch with
Then you update your local develop branch with
or
Then make your feature off of the latest develop with:
Double check with git log:
You should see the commit and the fact that develop, orgin/develop, myfeature and HEAD all point to the same thing. You can now work in the new branch and the work will be the latest as of the point in time when you fetched.
只需使用 git checkout -tb myfeature origin/develop (假设您已命名远程
origin
),Git 就会为您跟踪远程分支。Simply use
git checkout -tb myfeature origin/develop
(assuming you've named the remoteorigin
), and Git will track the remote branch for you.