Git Commands

Table of Contents

Some git commands.

Push Master

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

Remote Show

1
git remote -v

Remote Remove

1
2
git remote remove origin
git remote remove <name>

Add/Stage

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

Remove From Stage

1
git rm <file/dir>...

Commit Staged Changes

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

Tag

1
2
3
4
5
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

1
git push --tags

Submodule Add

1
2
submodule add https://github.com/J-Siu/binario themes/binario
submodule add <url> <path>

Submodule Update

1
git submodule update --recursive --remote

Status

1
git status

Log show

1
2
git log
git reflog

Revert

1
2
git revert b68bc59
git revert <ref#>

Config User

1
2
git config --global user.name "<Full Name>"
git config --global user.email "<email>"

Config List

1
2
git config -l
git config --global -l

Tag Date

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