Git: Make one branch exactly like another

后端 未结 4 732
孤独总比滥情好
孤独总比滥情好 2021-01-21 04:29

I am relatively new to Git, and I\'m still not very comfortable with it. Right now, I\'m looking for the command/options/magic that can make the current branch look like anothe

4条回答
  •  再見小時候
    2021-01-21 05:08

    I know this was asked awhile ago, and there are a few answers already, but I thought I would offer my 2 cents:

    If you're looking to do a git merge and you don't want to worry about merge conflicts (always prefer the changes in one branch over another), then you can use git merge branch -X ours and git merge branch -X theirs. There's more explanation on this in https://stackoverflow.com/questions/13594344.

    I would argue, however, that a git rebase would make more sense here. Some pros/cons are on the Rebase vs. Merge page. The merge is intended to retain a history of events that transpired including the merge itself, but from the sound of your question it seems like you're only looking to keep track of the events in the application development, hiding the fact that you ever had a separate branch in the first place.

提交回复
热议问题