Git Commands

Table of Contents

Some git commands.

Push Master

git push -u origin master
git push -u <name> master

Remote Show

git remote -v

Remote Remove

git remote remove origin
git remote remove <name>


git add . # Add everything in current dir tree. This include sub-dir recursively.
git add <file/dir>...

Remove From Stage

git rm <file/dir>...

Commit Staged Changes

git commit -m '<comment>'
git commit -a # Commit all staged files.
git commit <file/dir> # Commit files directly even not staged.


git tag # List tags
git tag <version> # Light weight tag
git tag -a v0.1 -m "Version 0.1"
git tag -a <version> -m '<comment>'
git show <version> # Show tagged commit

Push tag

git push --tags

Submodule Add

submodule add themes/binario
submodule add <url> <path>

Submodule Update

git submodule update --recursive --remote


git status

Log show

git log
git reflog


git revert b68bc59
git revert <ref#>

Config User

git config --global "<Full Name>"
git config --global "<email>"

Config List

git config -l
git config --global -l

Tag Date

git log --tags --simplify-by-decoration --pretty="format:%ai %d" | cat
John Siu
Minimize the Effort, Maximize the Effect!
comments powered by Disqus