git cheatsheet

A small cheatsheet containing the basics needed on a day-to-day basis with git

View on GitHub

Basic knowledge

cd 				// Moves you to the home directory
cd .. 				// Moves you to the one directory out (Parent directory)
cd <DIRECTORY NAME>		// Moves you into directory

ls				// Lists the directory contents

mkdir <DIRECTORY NAME> 		// Creates a directory (folder) at current location



Basic usage


More advanced usage


Commands coming soon™

git clean
git merge
git rebase
git fetch

Personal favourites

git commit -a --amend --no-edit 	// Adds and amends changes to the last commit
git checkout -b <branch> 		// Shortcut for creating and checking out a new branch
git blame <FILENAME>			// Shows file with log of who committed which line

Pretty git log?

Do you want that pretty pretty log instead of the bulky old one?
It looks like this (With slightly more color)

* 0575e8f - Testing theme (4 days ago) <Jon Johansen>
*   9770331 - Init github pages (7 days ago) <Jon Johansen>
|\
| * 01442b9 - Set theme jekyll-theme-hacker (7 days ago) <Jon Johansen>
* | e697e75 - Init gitignore and github pages (7 days ago) <Jon Johansen>
|/
* 6523eae - Init / Add readme (7 days ago) <Jon Johansen>

Source: Pretty git Log


Other great resources

Anything missing?

Feel free to create a pull request.


Written & managed by jonjohansen for Tromsøstudentenes Dataforening