The GIT Cheat Sheat

In this article, I’ll be enlisting some of the most common git commands I use when working on software projects.



# configure the environment and working user
git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"
git config --global color.ui true


# create the bare repository (for push/pull)
repo=repository.git
mkdir $repo && cd $repo && git init --bare

# create the working repository
git init

# view remotes
git remote -v

# add remotes
git remote add origin {location}

# remove remotes
git remote rm origin


# pull from the origin repository
git pull origin master

# push to origin repository
git push origin master


# view the log
git log

# view the status
git status


# stage all modifications
git add -u


# commit inline
git commit -m "Commit message"

# commit with editor
git commit -a



# show file from a commit by distance 1,2,3,4
git show head~1:readme.txt
git show head~2:readme.txt
git show head~3:readme.txt
git show head~4:readme.txt


# branching and merging: todo! soon!

Linux Shell / Bash Scripting, Tutorials, Version Control | Posted on July 2, 2013 by .

About Kristijan Burnik

Kristijan Burnik is a Programmer and Web Developer specializing in Server-side and Client-side Technologies and Application Development on Linux Servers and Windows Desktop . Also has experience in Networking, Desktop application development as well as Android mobile application development . Experienced in Programming Languages like Java, C, C++, C#, PHP, Javascript, MySQL and somewhat in other languages like Bash, Perl & Python. Sometimes he works as a Graphical Designer for digital production as well as for printing and advertising. He dedicates his spare time writing Tech Articles on his blog in order to share his work with others, as well as to document his projects for his own use. He's also an Educator & Mentor in field of Algorithms and Programming to young programmers in Zagreb, Croatia.

Leave a Reply