I worked on master branch, and after the project was finished I created a branch X for the specific project. Now I have changed a lot in the master branch and want to move those changes to branch X as well.
I don't want to merge because merge would mean that changes in X would also be present after the merge right?
I want master and X to be exactly the same
If you want merge master and X-project branch by keeping only master version when conflicts raise you must use the theirs merge strategy :
# checkout out in X project branch and
git merge -s theirs master
You'll find more detail in the documentation of merge : http://git-scm.com/docs/git-merge
If you want master
and X
to be exactly the same and thereby drop all changes you made on X
the easiest way would be to delete X
and create a new one.
git checkout master
# the big 'D' means you want to delete an unmerged branch
git branch -D X
# create a new 'X'
git branch X
Have a look at this answer https://stackoverflow.com/a/15943471/2418066 .
For your case you should execute this:
git push origin +master:X
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.