Git Cheatsheet

Git Cheatsheet

January 4, 2020
Cheatsheets
★ Star me on GitHub

Get the meaning of Git command: just copy it and paste to explainshell


Stats of submission

git shortlog -sne

List log in fancy style (from @AntonioAnerao):

git log --all --graph --decorate --oneline

Change the default commit editor

git config --global core.editor `which vim`

Edit the last commit message

git commit --amend

Commit case-sensitive only filename changes

git config core.ignorecase false

Unmodifying a Modified File:

git checkout -- [path/filename]

List existing remotes

git remote -v

Set new remote url:

git remote set-url origin [repo_url]

List all branch:

git branch -a

Change current branch:

git checkout [branch_name]

Merge branch:

git merge [branch_name]

Create temporarily workspace

git stash
git stash list
git stash pop 

Move to the specific commit:

git reset --hard [commit_hash]

Using submodule:

git submodule add url
git submodule init
git submodule update

Clone repo with submodule:

git clone --recursive [url]