GitCommand

4 space: work cache native remote

Directory

add

add all files to cache
git add .
add some files to cache
git add <file>...

branch

create
git branch <branchname>
delete native
git branch -d <branchname>
delete romote
git branch -r -d origin/<branchname>
git push origin :<branchname>
list all native branch
git branch
list all remote branch
git branch -r

checkout

create & checkout Immediately
git checkout -b <branchname>
checkout
git checkout <branchname>
discard changes
git checkout -- <file>
discard all changes
git checkout .

clone

clone project
git clone https://github.com/wyhazq/GitCommand.git

commit

commit to native with modify info
//1
git add .
git commit -m 'modify info'

//2
git commit -am 'modify info'

config

current git userInfo
git config -f .git/config user.name 'username'
git config -f .git/config user.email test@github.com
global userInfo
git config --global user.name 'username'
git config --global user.email test@github.com
list config
git config --list

diff

work & native diff
git diff
native & remote diff
git diff --cached
both diff
git diff HEAD
short diff
git diff --stat

fetch

all update
git fetch
current branch
git fetch origin
a branch
git fetch origin <branchname>

log

all log
git log
short log
git log --oneline
graph log
git log --oneline --graph
reverse log
git log --reverse
author log
git log --author=<username>
time log
git log --before={3.weeks.ago} --after={2008-08=08}
no merge log
git log --no-merges

merge

git merge <branchname>

mv

git mv <filename> <new filename>

pull

git pull origin

push

push current branch
git push origin
push a branch
git push origin <branchname>

rm

remove work file
git rm <file>
remove work & native file
git rm -f <file>
remove native file
git rm --cached <file>
remove all file
git rm –r * 

remote

remote info
git remote -v

reset

reset all cache file to work
git reset .
reset cache file to work
git reset <file>
cancel last commit
git reset --hard HEAD^

revert

revert last commit
git revert HEAD
revert commit version
git revert commit <commitId>

status

short status
git status -s
all status
git status

tag

add native tag
git tag -a <tagname> -m 'modify info'
delete native tag
git tag -d <tagname>
delete remote tag
git push origin :refs/tags/<tagname>
list tags
git tag
push tag
//1
git push origin <tagname>
//2
git push --tags

change git history author info

change git history author info