Showing which files have changed between two revisions
To compare the current branch against master
branch:
$ git diff --name-status master
To compare any two branches:
$ git diff --name-status firstbranch..yourBranchName
There is more options to git diff
in the official documentation (and specifically --name-status
option).
Try
$ git diff --stat --color master..branchName
This will give you more info about each change, while still using the same number of lines.
You can also flip the branches to get an even clearer picture of the difference if you were to merge the other way:
$ git diff --stat --color branchName..master
Also keep in mind that git has cheap and easy branching. If I think a merge could be problematic I create a branch for the merge. So if master
has the changes I want to merge in and ba
is my branch that needs the code from master I might do the following:
git checkout bagit checkout -b ba-mergegit merge master.... review new code and fix conflicts....git commitgit checkout bagit merge ba-mergegit branch -d ba-mergegit merge master
End result is that I got to try out the merge on a throw-away branch before screwing with my branch. If I get my self tangled up I can just delete the ba-merge
branch and start over.