User login

diff

Get a Git diff of the previous commit

Getting a diff (patch-file style display of changes) from a your most recent commit is useful when you commit and it lists three lines changing in a file instead of one. Of course, you should have run git diff --cached before git commit -m "I know what I'm doing.", but when you haven't, or have another reason to take one step back in the history of your work, here is the command that saves looking up the git commit hash.

git diff HEAD^ HEAD

Checking the difference between a file modified locally and the repository with git

[done this before, never made a note of it]

git see difference between current and repository file

git diff

It's really that easy.

Additions in your local working copy are represented by + signs, subtractions by your local working copy are each preceded by a - sign.

http://media.pragprog.com/titles/tsgit/chap-005-extract.html

Syndicate content