I switched to a feature branch that I was working on and has been merged into the master branch.
I wanted to find out what changes I made on that branch, compared to the commit from which I created the branch and on which my work was based.
What commands can I use to find out that?
Thanks.
答案 0 :(得分:1)
You can do a diff with the actual commit ids to see the difference between any two commits in the same branch. You can use this format
git diff [or difftool] {first commit id} {second commit id} [optional path\filename]
e.g.
git difftool 9055ab693fdb1d63b76860b14bc21471e2fafae2 3f2a0e392d868e1af479e44fd6e4385e1b958574 folder\index.html
from gitdiff man page here
答案 1 :(得分:1)
If your branch was created from master
, then use the following command:
git diff master...your_branch
git diff [--options] <commit>...<commit> [--] [<path>...]
This form is to view the changes on the branch containing and up to the second
<commit>
, starting at a common ancestor of both<commit>
s. "git diff A...B
" is equivalent to "git diff $(git-merge-base A B) B
". You can omit any one of<commit>
, which has the same effect as usingHEAD
instead.