开发者

after rebasing on a branch, how to update master to match that rebased branch?

I've done a bunch of rebasing on a test GIT branch. The rebasing was done for two reasons: #1: to integrate changes in a parent git-svn trunk; #2: to clean up my local history in preparation for handing off the code to another developer.

I have my test branch the way I want it, all tests are passing, etc. Now I want to make master look just like my test branch.

What's the preferred way to do this? If master weren't there already, I'd just git clone it, but is there another better way t开发者_如何学JAVAo force an existing branch to look just like anohter (including history)?


Deleting the branch and recreating it where you want it does work, but it costs you your reflogs - the record of where the branch has pointed in the past. The two cleaner ways:

# if you want the branch checked out:
git checkout master
git reset --hard <other-branch>

# or, if it's not checked out:
git branch -f master <other-branch>


The proper way to make a branch look like another (including history) is to just create a new branch.

The master branch is just another branch (git simply sets that to be the default when initializing a new repository, but you are free to set your own default branch).

If I understand you correctly, just delete the master branch and create a new branch called master using the test branch.


What I do is merge my work branch into my master branch (it has my initials prefixed). Then I push that master, which the one-committer reviews and merges into the real master.

so the answer is, merge, i think

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜