My Custom Git Cheet Sheet Command

git identity

- git config --global "Addhe Warman"
- git config --global ""

git editor

- git config --global core.editor vim

git diff tool

- git config --global merge.tool vimdiff

git check settings

- git config --list

git help

- git help
- man git

git initial a repository in existing directory

$ git init
$ git add sample.txt
$ git add README
$ git commit -m 'first initial project versioning'

git cloning existing repository

$ git clone

$ git clone

git check status of your file changes

$ git status

git tracking new files

$ git add YOUR_FILE

$ git add YOUR_FILE_1 YOUR_FILE_2

git how you commit your changes

$ git status

$ git diff


$ git commit -m 'i have updated my file'

$ git log

$ git show SHA_NUM

git revert your changes

$ git checkout YOUR_MODIF_FILE

git revert one commit

$ git reset HEAD~1


$ git revert HEAD

git ignore file

$ vim .gitignore

git check your ignore file

$ cat .gitignore

git compare your changes

$ git diff

$ git diff --cached

git compare staged changes to your last commit

$ git diff --staged

git commit your changes

$ git commit -m '
i made this cheatsheet as simple and posible
as clear as clean water and 5 years old kid can
learn and read it

$ git commit -a -m '
add -a will add everything without have to add
or using git add one by one

git remove file that you already add

$ git rm YOUR_FILE

$ git rm *~

$ git rm log/*.log

git moving files

$ git mv file_from file_to

git show commit history

$ git log

$ git log -p -2

git series of summarizing option

$ git log --stat

git log output to formats other than default (one liner)

$ git log --pretty=oneline

git log output to your own format

$ git log --pretty=format:"%h - %an, %ar: %s"

git limit log output

$ git log --since=12.weeks

git log commit by awan in december 2014 to january 2015

$ git --pretty="%h:%s" --author=awan --since="2014-12-01" --before="2015-01-28"

git log pretty format with ASCII graph visual of your branch and merge

$ git log --pretty-format:"%h %s" --graph

git commit forget one file to commit

$ git commit -m 'i commit this and i forget one file'
$ git add file_kelupaan
$ git commit --amend

git command to revert one file from list of your git add

case : dayummm i git add everything, i should not add them all this cubbysmart.txt should not in the list

awan@google:~/django# git add .
awan@google:~/django# git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
# new file: awan.txt
# new file: cubbysmart.txt
# new file:
# new file:
# new file:
awan@google:~/django# git reset HEAD cubbysmart.txt
awan@google:~/django# git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
# new file: awan.txt
# new file:
# new file:
# new file:
# Untracked files:
# (use "git add ..." to include in what will be committed)
# cubbysmart.txt

git unmodifying a modified file

$ git checkout

git showing your remotes

$ git remote

$ git remote -v

git add remote repository

$ git remote add awan_cloud git://

awan@google:~/django# git remote
awan@google:~/django# git remote -v
origin ssh:// (fetch)
origin ssh:// (push)
awan@google:~/django# git remote add awan_cloud git://
awan@google:~/django# git remote -v
awan_cloud git:// (fetch)
awan_cloud git:// (push)
origin ssh:// (fetch)
origin ssh:// (push)

git get data from remote projects

$ git fetch your_remote

$ git fetch awan_cloud

git push to your remote

$ git push origin remote

$ git push origin awan_cloud

git inspecting a remote

$ git remote show origin

$ git remote show awan_cloud

git remove and rename remotes

$ git remote rename awan_cloud cloud_aws

$ git remote

$ git remote rm cloud_aws

git tag your revision

$ git tag

$ git tag -a your_tag_name -m 'my first tag' your_sha_revision_id

awan@google:~/django# git tag -a my_tag -m 'tset tag' 22d9cd99b2184967033fd14b1be8cd5c88a1d037
awan@google:~/django# git tag -l
awan@google:~/django# git show my_tag
tag my_tag
Tagger: Awan
Date: Sun Aug 30 23:09:26 2015 +0700

tset tag

commit 22d9cd99b2184967033fd14b1be8cd5c88a1d037
Author: Awan
Date: Wed Apr 16 08:17:40 2014 +0700

update code

diff --git a/ b/
new file mode 100644
index 0000000..70166b0
--- /dev/null
+++ b/
@@ -0,0 +1 @@
+#addhe warman django project

git sharing tag

$ git push origin my_tag

git alias

$ git config --global checkout
$ git config --global branch
$ git config --global commit
$ git config --global status
$ git config --global alias.unstage 'reset HEAD --'
$ git config --global alias.last 'log -1 HEAD'

git check your current branch

$ git branch

git create a branch

$ git checkout -b MY_NEW_BRANCH

git push changes to branch

$ git push origin MY_NEW_BRANCH

git pull from branch

$ git pull origin MY_NEW_BRANCH

git change back to master branch

$ git checkout master

git merge branch to master

$ git checkout master
$ git merge MY_NEW_BRANCH

—————— continue to part 2


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s