为什么 git 会修改我的文件?我该如何撤消它?
嘿,所以我是一个完整的 git 新手,我所做的最高级的事情只是基本的拉/推等。
出于我不明白的原因,我的一个提交编辑了一堆文件,包括嵌入到文件中自上次提交以来我所做的编辑,例如:
foo.txt:
bar
那么如果我将其编辑为:
foobar
提交时的文件更改为类似:
<<<<<<< HEAD
bar
=======
foobar
>>>>>>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X 是提交代码或其他内容。
对我的源文件进行的这些编辑是什么?如何删除它们?
感谢您对此的任何帮助
Hey, so I'm a complete git newbie here, the most advanced thing I've done is just basic pulls/pushes .etc
For reasons I don't understand one of my commits edited a heap of files, including embedded into the file the edits I made since the last commit, for example:
foo.txt:
bar
then if i edited it to:
foobar
the file upon committing got changed to something like:
<<<<<<< HEAD
bar
=======
foobar
>>>>>>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
with the X's being the commit code or whatever.
What are these edits to my source files, and how do I get rid of them?
Thanks for any help with this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些代表合并冲突。您的提交导致文件发生冲突。
代表 HEAD 中已经存在的内容,
显示您正在尝试合并的内容。
请参阅此处的“解决合并”部分: http://git -scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
Those represent merge conflicts. Your commit is causing conflicts to the file.
represents what is already in the HEAD
shows what you are trying to merge.
Look here at Resolving a Merge section: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
除了 manojlds 之外:
您还可以使用以下配置指定在合并冲突中使用共同祖先的版本(用管道 ||||| 分隔):
这将使冲突看起来像:
查看更多关于 < a href="http://blog.wuwon.id.au/2010/09/painless-merge-conflict-resolution-in.html" rel="nofollow">凯文的博客
In addition to manojlds:
You can specify to have the version of the common ancestor in your merge conflict (separated by pipes |||||), by using the following configuration:
This would make the conflict look like:
Check out more on Kevin's Blog