Allan's Blog

Useful Git Command

同步远程和本地目录

git init
git remote add origin $url_of_clone_source
git fetch origin
git checkout -b master --track origin/master # origin/master is clone's default

展示远程的分支

git branch -a

展示远程的仓库地址

git remote -v

reset

git reset --hard HEAD~1

stash

//stash files
git stash

//list all stash
git stash list

//apply near stash
git stash apply

//apply index stash
git stash apply --index

设置你的邮箱

git config --global user.name "Allan Chan"
git config --global user.email "allan@example.com"
Allan Chan