gerrit出现Merge Conflict,小白解决心路历程

错误的解决之路
上出现Merge 时
在IDEA进行git pull时,会出现冲突如下所示,用HEAD>>>标出来
error: could not apply ec2a685ab...hint: Resolve all conflicts manually, mark them as resolved withhint: "git add/rm ", then run "git rebase --continue".hint: You can instead skip this commit: run "git rebase --skip".hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
此时,我就慌了啊,怎么解决呢,那我先去删除我的冲突地方,即HEAD>的地方,保留上面的,上面是人家写的,我的是下面的
然后我进行git stash save "XXX",把我现在修改的进行保存起来,进行之前的类似的提交操作,结果出现如下报错
xxxx.java: needs merge
没办法我就不进行更新了,那老子直接进行git add .
吆西,成功了
鬼知道我怎么这么迷恋git stash save "xxxx",没想到成功了(报错的源头,因为我居然在no 分支上,说明保存错了啊)
Saved working directory and index state On (no branch): name
我进行git pull,错误升级,变成这样了
You are not currently on a branch.Please specify which branch you want to rebase against.See git-pull(1) for details.

gerrit出现Merge Conflict,小白解决心路历程

文章插图
行吧,git pull不行对吧,老子进行git stash pop stash@{0},没想到居然冒出这玩意,错误加倍
interactive rebase in progress; onto 12beffbb8Last command done (1 command done):......(use "git rebase --edit-todo" to view and edit)You are currently editing a commit while rebasing branch 'dev_ecloud' on '12beffbb8'.(use "git commit --amend" to amend the current commit)(use "git rebase --continue" once you are satisfied with your changes)Changes not staged for commit:(use "git add ..." to update what will be committed)(use "git restore ..." to discard changes in working directory).......
告诉我当前正在编辑的东西,如果提交的将会覆盖这个“” 。使用git 进行代码覆盖,但是上次提交的进程还没有完成导致的 。
老子不管三七二十一,先给它push上去,看看能咋地,结果成功了 。但是我之前的任务被拉取的代码给覆盖,我大呼奇迹,简直魔术师转世 。老子的代码都丢了,又得去再拷贝一遍 。
我再看看我在哪个分支,用git-a,显示如下:
* (no branch, rebasing dev_ecloud)dev_ecloudmaster
老子甚至百度了,人家解决这种问题,就是创建临时分支,然后拉取dev分支,将临时分支合并到dev分支,删除临时分支
//先用git status查看现在临时分支的名字git statusinteractive rebase in progress; onto 12beffbb8Last command done (1 command done):pick .....(use "git rebase --edit-todo" to view and edit)You are currently editing a commit while rebasing branch 'dev_ecloud' on '12beffbb8'.(use "git commit --amend" to amend the current commit)(use "git rebase --continue" once you are satisfied with your changes)nothing to commit, working tree clean//创建临时分支git branch temp 12beffbb8//拉取dev分支git checkout dev_ecloudAlready on 'dev_ecloud'Your branch and 'origin/dev_ecloud' have diverged,and have 3 and 1 different commits each, respectively.(use "git pull" to merge the remote branch into yours)//拉取远程dev分支git checkout remotes/origin/dev_ecloud//进行将临时分支合并到拉取的分支上git merge temp Auto-merging xxx.javaCONFLICT (content): Merge conflict in xxx.javaAutomatic merge failed; fix conflicts and then commit the result.//看不懂上面,老子觉得大事不好,就删除临时分支git branch -D temp