git merge 在一个命令中
我现在住在A分行。我想将分支 A 合并到分支 B 并切换到分支 B,如何在一个命令中完成此操作?
现在我必须签出branch-B,并将branch-A合并到其自身中。 B/c 我在合并时保持 IDE 打开。当我签出另一个分支时,ide(xcode) 可以赶上文件的更改,并且通常会崩溃。我所做的合并通常是快进的。所以我想知道是否有一种方法可以在不更改文件的情况下进行快进合并,只需将 HEAD 和分支 B(通常是 dev 分支)设置为最新提交,谢谢
I'm now staying at branch-A. I want to merge branch-A into branch-B and switch to branch-B, how can I make this in one command?
Now I have to checkout branch-B ,and merge branch-A into itself. B/c I kept the IDE opened while merging.when I checkout another branch, the ide(xcode) can catch up the files' changing, and crashes usually. The merge I made usually goes with fast-forward.So I'm wondering if there is a way to make fast-forward merge without files' changing,just set the HEAD and branch-B(usually dev branch) to the lastest commit,thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果合并速度快进,您可以通过 在切换到合并到的分支之前,合并到 git 中的一个分支而不切换到它。
然后可以通过别名来实现在 1 个命令中完成它。
Provided the merge is fast forward, you can solve the IDE problem by Merging to a branch in git without switching to it before switching to the merged-to branch.
Then doing it in 1 command can be achieved by aliasing.
我真的不明白为什么输入两个命令这么麻烦:
...但如果它真的太“挑剔”,你可以创建一个 git 别名来执行此操作。例如,尝试:
然后您可以这样做:
这将签出您作为参数提供的分支,然后合并到您所在的上一个提交中。
I really don't see why it's such a hassle to type two commands:
... but if it's really too "fussy" you could create a git alias to do this. For example, try:
Then you can just do:
That'll checkout the branch you supply as a parameter, and then merge in the previous commit that you were at.