only changed files:
git add -u
only changed and new (but not deleted)
git add .
changed, new, and deleted
git add -A
git fetch origin
i.e., if you are in the local development branch:
git merge origin/development
git diff -b
git checkout <file>
-
If you just want to change the commit message:
git commit --amend -m "New commit message"
-
You can also add more files and then use
--amend
to have those files included in the commit. -
If you want to rewind to the point before you did "git add":
git reset HEAD^
-
If you want to rewind to the point before you did "git commit" (still have changes staged):
git reset --soft HEAD^
See this Stack Overflow answer for more details.
-
Show diffs in addition to commit messages:
git log -p
-
Find a changeset of interest for a particular file:
git log -- path/to/file
(use dashes if file has been deleted; put quotes around dashes if in PowerShell) -
Show what was changed at a specific revision:
git show [type the first few characters of the commit identifier]
-
Search for a commit based on content of commit message:
git log --grep=pattern
-
Search for a commit based on something that was changed (i.e., the diff):
git log -i -S string_to_search
-- the -i makes it case-insensitive -
Search for a commit based on diff content, and show the diff, along with other files changed:
git log -i -S string_to_search -p --pickaxe-all
-
Show filenames that were changed at a specific revision:
git show --name-only [commit identifier]
-- shows only filenames -
Show the entire file as it looked at a specific revision:
git show [commit identifier]:filename.ext
git rm --cached <file>
git ls-files -m