预备工作
配置用户信息:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
检查配置信息:
git config user.name
git config user.email
git config --list
一、本地常用操作
提交改动:
$ git add all # 提交所有变动
$ git commit -m "update"
$ git push
版本回退:
$ git reflog # 查看历史变更记录
$ git reset --hard HEAD@{n} # n是要回退到的引用位置
# 另一种方式
$ git log
$ git reset --hard commitID
新建并切换到一个新的分支上工作:
$ git checkout -b <dev>
Switched to a new branch 'dev'
更改分支名称:
$ git branch -m <old_branch> <new_branch>