Here is a reference list of some useful GIT commands which I use including GIT Aliases commands. If you know of or use any which are not here please post a comment so I can add them to help others! :)
GIT Bash for Windows (formerly known as GitWin) is shell command line tool for Windows users. It is essentially a Windows port of GNU bash “Minimalist GNU for Windows” (see msysgit projects website for more details).
Download GIT Bash
Useful GIT Commands
Show all branches.
$ git branch --all
Load GITK (Generalized Interface Toolkit) Good for seeing what changes have been made and who by in a nice interface.
Add (if applicable) and commit changes with a message.
git commit -a -m "msg"
Search the tree contents for specific phrase and filetype. ie find the word “CSS” in all .js files.
git grep "css" -- *.js
Create a zipped backup of the current branch.
$ git archive --format=zip master^>backup-10-04-2013.zip
View local GIT config.
$ cat .git/config
Useful GIT Alias Commands
GIT Alias Commands can save you heaps of time typing in long-winded commands into your GIT CMD. They basically map a long command into whatever shorthand version you wish. They also can be configured to prettify/colorify your results. Official post on git alias commands. Also see: Must Have Git Aliases: Advanced Examples.
Show a pretty git log history.
$ git config --global alias.history "log --abbrev-commit --pretty=oneline --graph --decorate" usage: $ git history
Show the last commit.
$ git config --global alias.last 'log -1 HEAD'usage: $ git last usage: $ git last
Reset to state of your last commit.
$ git config --global alias.resetlast 'reset --hard HEAD' usage: git resetlast
Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.
Your First Year in Code
Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers
Jump Start Git, 2nd Edition