把主人头移到一个分支 [英] Moving master head to a branch

查看:84
本文介绍了把主人头移到一个分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个功能分支和一个主分支。 Feature2完成。通常我会重新分配(使用远程SVN回购,并希望保留历史记录,所以不需要定期合并)和ff-merge。但是,自从我分支以来,主人没有改变,我想将主人的头( E )移到 G 。使用 git branch -f master G 不会导致任何可见的变化,我认为这是因为 G 在一个不同的分支。

I have several feature branches and a master branch. Feature2 is done. Normally I would rebase (working with a remote SVN repo and would like to keep the history, so no regular merge) and ff-merge. But since master hasnt changed since I branched, I would like to move the master head (at E) to G. Using git branch -f master G does not result in any visible changes, I assumed this is because G is on a different branch.

在这里使用 git update-ref -f master G 是否安全?我应该坚持使用rebase / ff-merge吗?更好的东西?

Is it safe to use git update-ref -f master G here instead? Should I stick with rebase/ff-merge? Something even better?

feature1      C-D  
             /
master    A-B-E            
               \                      
feature2        F-G  

谢谢。

Thank you.

推荐答案

    feature1      C-D  
                 /
    master    A-B-E            
                   \                      
    feature2        F-G

git checkout master
git merge feature2

    feature1              C-D  
                         /
    master, feature2  A-B-E-F-G

这篇关于把主人头移到一个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆