基础
创建新仓库
git init
git remote add origin <server>
克隆
git clone /path/to/repository
git clone username@host:/path/to/repository
添加和提交
git add <filename> // or git add *
git commit -m "代码提交信息"
推送改动
git push origin master
分支
git checkout -b feature_new
git checkout master
git branch -d feature_new
git branch -m new_name
git push origin <branch>
更新与合并
git pull
git merge <branch>
标签
git tag 1.0.0 1b2e1d63ff前10位
替换本地改动
git checkout -- <filename>
git fetch origin
git reset --hard origin/master
其他
git config format.pretty oneline
高级