tags:

views:

269

answers:

1

I am using git for windows to manage a local project. I have two branches, 'master' and 'change_specific'. I have added some extra files to 'change_specific'. Those files don't show up when I switch to 'master'. When I call

git merge -m "don't need old branch" master change_specific

git tells me "Already up-to-date. Yeeah!". Yet the branches seem to have different files. I would like to delete 'change_specific' and be done with it, yet I am afraid that will wipe out my added files - a bad thing. It seems there is something I missed when I scanned the git documentation. What is going on and what should I do?

+8  A: 
# git checkout master
# git merge change_specific

That should do it. git merge <branch1> <branch2> actually tries to merge three branches, the two you gave on the command line and the current branch. If two of them are actually the same it might explain the “Already up-to-date” message.

If you haven’t exposed your changes to the world yet I’d rather perform a rebase:

# git checkout change_specific
# git rebase master
# git checkout master
# git merge change_specific

This will apply the changes from the “change_specific” branch to the current master, rewriting the history linearly. After this you can safely delete the “change_specific” branch with git branch -d change_specific.

Bombe