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>

Add/Stage

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.

Tag

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 https://github.com/J-Siu/binario themes/binario
submodule add <url> <path>

Submodule Update

git submodule update --recursive --remote

Status

git status

Log show

git log
git reflog

Revert

git revert b68bc59
git revert <ref#>

Config User

git config --global user.name "<Full Name>"
git config --global user.email "<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