I use git as my source control system. Here are some of the most common git commands in no particular order.

Check Out a git Repository git clone /path/to/repository
Add files to commit git add <filename>
Commit files to git git commit -m “Commit message”
Push changes to server git push origin master
Show status git status
Create new branch git checkout -b <branchname>
Switch to a branch git checkout <branchname>
Get remote changes git pull
Merge a different branch into the current one git merge <branchname>
View merge conflicts git diff
Temporarily stash uncommitted changes git stash
Undo a commit git reset –hard <commit>
Show details about a commit git show <commit>
Show version history of current branch git log
Gets all remote branches git fetch origin

Most of the time I use the git extensions tools to do my git work, but there are times when only the command line will do.

This post has already been read 888 times!

Simon Foster on GithubSimon Foster on LinkedinSimon Foster on Twitter
Simon Foster
Web Developer
I have worked in SysAdmin and IT Management but now work as a Web Developer. I love everything IT related and I am trying to learn as much as I can especially about DevOps. Why not follow me on twitter?