merge conflict

  1. git stash

git push提示冲突

2024-04-09-19-47-59

会在源文件中看到标记的冲突的HEAD

2024-04-09-19-48-22

修改完在git add . 再commit push

如果没有实质差异,“current change”是你的修改的,那个commit id的是已存在的,按照已存在的来

git stash

git stash

git commit

git stash pop

接下来diff一下此文件看看自动合并的情况,并作出相应修改。

git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。

git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。

git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。

git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。


Welcome to point out the mistakes and faults!