Two quick tips that I use all the time.
Put this file in your home directory somewhere (eg ~/.git-shortcuts):
| alias s='git status' | |
| alias co='git checkout' | |
| alias c='git commit -m' | |
| alias b='git branch' | |
| alias push='git push' | |
| alias pull='git pull' | |
| alias d='git diff' | |
| alias dc='git diff --cached' | |
| alias a='git add' |
Then add this line to ~/.bash_profile:
. ~/.git-shortcuts
This makes working with git repos SUPER easy:
co my-branch # checkout a branch
pull # pull latest
s # check status
d # see unstage diffs
a * # add everything
dc # see the staged diffs
c "my commit" # commit with the given message
push # push to remote
If you want to review the changes you're staging, or you want to only pick out a few changes, add the -p parameter:
git add -p *
a -p # with my shortcuts
There will be instructions along the bottom of the CLI.
The commands I use are y for yes, n for no, s for split the chunk, and ctrl+c for cancel.