gpt4 book ai didi

git - 使用 Git merge 问题

转载 作者:IT王子 更新时间:2023-10-29 01:16:54 25 4
gpt4 key购买 nike

我正在使用 git version 1.7.11.msysgit.0

我在 GitHUB 下创建了一个存储库,并添加了一个名为 README.md 的文件,其中包含一些文本内容。

后来,我安装了 GIT 客户端,做了一个克隆以将服务器内容放到我的机器上。

然后我删除了本地机器上的 README.md 文件。

现在当我执行 git commit 时,我得到了这个错误

praveenk@MSIN-BT-100 /d/workspace/MYTestRepo (master|MERGING)
$ git commit ;
U README.md
error: 'commit' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: Exiting because of an unresolved conflict.

这是 git pull:

$ git pull;
U README.md
A One.txt
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

如何解决这些错误?

最佳答案

这样做:

git merge --abort
git pull (to be sure you're up-to-date)

现在用你想要的内容替换 README.md 文件的内容。如果你根本不需要它,请执行 git rm README.md

然后,如果您替换了内容,提交并推送这些内容:

git add README.md
git commit -m "comment"
git push

关于git - 使用 Git merge 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11527069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com