
git help |
Get help on a command | $ git help push |
git config |
Configure Git | $ git config --global … |
source <file> |
Activate Bash changes | $ source ~/.bash_profile |
mkdir -p |
Make intermediate directories as necessary | $ mkdir -p repos/website |
git status |
Show the status of the repository | $ git status |
touch <name> |
Create empty file | $ touch foo |
git add -A |
Add all files or directories to staging area | $ git add -A |
git add <name> |
Add given file or directory to staging area | $ git add foo |
git commit -m |
Commit staged changes with a message | $ git commit -m "Add thing" |
git commit -am |
Stage and commit changes with a message | $ git commit -am "Add thing" |
git diff |
Show diffs between commits, branches, etc. | $ git diff |
git commit --amend |
Amend the last commit | $ git commit --amend |
git show <SHA> |
Show diff vs. the SHA | $ git show fb738e… |
Ready to be staged > Untracked: git rm –cached [file]
Staged > Untracked: git reset HEAD [file]
Committed to Staged: git reset –soft HEAD~1 (removes last commit)