简体   繁体   中英

merge branch that was created from old commit to master

I created a new branch from old master-commit. When trying to merge it with master using

git checkout master
git merge newbranch

I am getting

Already up to date

although it is a different code.

Of course there is an option to go back several commits (using git reset ) but this is not what I am looking for. I want to push / merge the newly created branch to master.

What is the best way to do that?

You need to go back to the master branch ( git checkout master ) and then merge in your new branch ( git merge <newbranch> ). That will pull over the changes from that branch into your master branch.

Read more here: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM