Search code examples
gitgithubversion-controlgit-merge

Merging changes from master into my branch


I have two branches in git: master and custom_branch.

Somebody added some code to master that I need to use in my custom_branch. I tried this:

git branch custom_branch
git merge master

But when I do that, it says:

Already up-to-date.

But, when I compare master and custom_branch, the changes are still not there. What am I missing?

P.S. I don't want to rebase since other people also use this branch.


Solution

  • git checkout custom_branch && git rebase master

    This will update custom_branch with changes from master branch.

    Don't forget to make sure master is up to date first. git pull


    This is also possible with git checkout custom_branch && git merge master


    For an explanation on why the first one is (probably) what you should be using: When do you use git rebase instead of git merge?