将多个 git 分支合并到 master 中?
所以我有 3 个 git 分支:
- master
- refresh
- auth_upgrade
我还没有像我应该的那样使用分支...所以 master
已经过时了,refresh
有点过时了,而 auth_upgrade
实际上是完全最新的分支。
所以...我最终希望将 auth_upgrade 设为 master 分支,然后将其 git push 到我的 github 存储库。
这样做的最佳流程是什么?
So I have 3 git branches:
- master
- refresh
- auth_upgrade
I haven't really been using branches like I should...so master
is way out of date, refresh
is somewhat out of date and auth_upgrade
is actually the branch that is completely current.
So...I ultimately want to make auth_upgrade
the master branch and then git push
it to my github repo.
What's the best process for doing that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将
auth_upgrade
拉入master
。master
上执行主线工作,并使用此分支与您的远程同步。refresh
。看:
You could pull
auth_upgrade
intomaster
.master
and use this branch to sync with your remote ..refresh
, if there are some unique changes you want to include ..see:
您可以使用
git 分支重命名分支 - m
选项:You can rename branches with the
git branch -m
option:如果当您说“过时”时,旧分支是严格的祖先,那么您实际上并没有任何合并问题。
如果您只想将当前分支放入远程存储库上的 master 分支,您只需执行以下操作:
编辑: 根据您的评论之一,听起来您没有来自远程的所有更改不过,您可能需要在当前分支中合并它们,然后才能成功推送:
然后您可以删除本地分支。使用小
-d
删除是安全的,因为它只删除当前分支的祖先分支。如果您对本地分支不被称为 master 感到困扰,您现在可以执行以下操作:
If when you say 'out of date' the old branches are strict ancestors then you don't really have any merge issues.
If you just want to make your current branch into the master branch on your remote repository you can just do:
Edit: from one of your comments it sounds like you don't have all of the changes from remote master in your current branch, though, so you may need to merge them in before pushing successfully:
You can then delete you local branches. delete with a small
-d
is safe in that it only deletes branches that are ancestors of your current branch.If it bothers you that your local branch isn't called master you can now do: