Comparing remote Git branches
I'm comparing remote branches, in order to see if a branch can safely be merged into Master, in order for Master to be released.
I'm doing the following:
git diff --name-status origin/develbranch ... origin/master
And I seem to get a correct list of files, like this:
AAAA www/images/widget/topdown/right_dis.png DDDD www/includes/htmlpurifier/library/HTMLPurifier/DefinitionCache/Decorator.php
My questions are:
- Am I doing this correctly?
- If I merge these branches, the DDDD file won't be deleted in Master right?
Actually, to get the diff the right way around you want to run
git diff --name-status origin/master ... origin/develbranch
That should work fine, but I'll show you some other nifty tricks:
git checkout master; git branch --no-merged
This will show all branches that aren't fast-forwardable to master, i.e. all non-merged branches.
git checkout master; git merge --no-ff --no-commit develbranch; git diff
This is the only way of knowing what the merge would actually look like. You can throw away the merge after you've looked at it with git reset --hard .
git branch --contains develbranch
Will show all the branches that develbranch could be fast-forwarded to. This is useful for checking which branches all the changes of develbranch have been merged to.