git notes main page | gitolite main page | license
although this page has a "gitolite.com" URL, this is not about gitolite.
That's just an artifact of "sitaramc.github.com" being translated to
"gitolite.com" and so ALL my git related stuff gets carried over.
Gitolite documentation has another
/gitolite in the URL, so
you can tell. My apologies for this confusion.
Git’s “…” operator is confusing, because it does different things in git diff and git log. Here’s something that may help you reason it out.
To start with, these points are fundamental:
git diff A..B, meaning “changes from A to B”, and
git log A..B, meaning “commits in B but not in A”.
To those simple rules, add just one more (easy enough to remember): the “
...” operator always involves the common ancestor somehow.
With those rules in mind, you can keep track of what the double-dot and triple-dot mean very easily.
git diff A...B:
...” is used, the common ancestor is involved
And this becomes
git diff CA(A,B)..B, where CA(A,B) is the common ancestor of A and B. Easy enough?
Now look at
git log A...B
...” is used, so the common ancestor is involved
git log CA(A,B)..A PLUS
git log CA(A,B)..B
^^loosely based on https://gitster.livejournal.com/25150.html^^
Assume you start from a “everything is committed and golden” state. Let’s pretend you came to this starting point via a
git checkout: and then you edit a bunch of stuff, compile/test, and then
git add and
$ git checkout mywork ...edit edit edit... $ git add ... $ git commit
If at this point you do a
git reset, here’s how the type of reset (“soft”, “hard”, or the default, which is “mixed”) affects things:
$ git checkout mywork # --hard resets to this point ...edit edit edit... # --mixed (default) resets to this point $ git add ... # --soft resets to this point $ git commit
Also note, as gitster says, that
git commit --amend makes the
git reset --soft mostly redundant.