git使用指南
1、git安装
2、简化的工作流程:
git pull --rebase //编码前,先pull到最新的代码
//编码....
git checkout -- xxx //放弃该文件的修改,适用于你修改了某个文件,但想还原它
git add xxx //提交你的修改到暂存区
git reset HEAD <file> //撤销add操作,放弃暂存
git commit -m "xxx" //编写commit信息
git pull --rebase //入库前将最新的代码拉下来
//若有冲突,修改冲突
git add xxx //提交修改的文件
git rebase --continue
git push origin HEAD:refs/for/master //若不是master分支,则将master改为当前分支名
若想将编译生成的中间文件删除,并且重新更新代码,适用于在服务器上编译、在本地提交:
git clean -df // 将不是本仓库的内容清除
git checkout -- * //回退差异代码
git pull -r //拉取代码
3、常见的问题
1) git提交的时候如果遇到does not match your user account
重置账号:
git config --global user.name "Your Name"
git config --global user.email you@example.com
还需要:
git commit --amend --reset-author
git config --global user.email you@example.com
还需要:
git commit --amend --reset-author

浙公网安备 33010602011771号