1 git merge origin/develop 将远程分支合并到本地,一般先执行合并,解决冲突,然后再git commit合入新建的分支,推送到远程分支里面,最后码云上找pl pull request到develop分支,对于有pull request还没审通过时,
再次提交的代码不会再次创建pull request,会自动合并到之前的pull request里面,等一次审核通过就行。
用git也是走了很多弯路。
比如:
这种错误
1.
$ git commit -a
fatal: Unable to create 'E:/****/.git/index.lock': File exists.
Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.
解决方法:
使用了$ rm -f ./.git/index.lock
然后我估计是点击了编辑,就出现了这个鬼
<****.github.io/.git/COMMIT_EDITMSG[+][RO] [unix] (18:21 22/07/2016)1,0-1 All
- 1
输入:wq!
(千万要记住!要加上去,万恶的电脑,少个符号都识别不了,这就是为什么我喜欢人脑)
然后就正常了
还有这种错误:
2.
出现这个问题是因为,没有在github账号添加SSH key,
为了方便,我用了HTTPS协议
8 查看日志
git log --pretty=oneline
9 git diff HEAD -- readme.txt 查看本地和版本库里面的区别
10 git 删除远程分支git push origin -d BranchName
11 git branch --set-upstream-to=origin/o87 新创本地分支关联远程分支
11
1 打开本地仓库位置,Git Bash here
2 把想要同步的这个仓库关联到本地 upstream
执行:git remote add upstream https://github.com/*******.git
3 查看状态确认是否配置成功
执行:remote -v
4 拉取仓库下所有分支
执行: git fetch upstream
5 把上游的远程代码合并到本地的 master分支
git checkout master
git merge upstream/master
6 现在你的本地master就同步到最新版了。执行: git push 推到你的远程就好了
17 代码回退到某个节点
git reset --hard 版本号
git push origin 分支 --force强推到某个分支