gpt4 book ai didi

git - pull 是不可能的,因为你有未 merge 的文件,git stash 不起作用。不想犯

转载 作者:IT王子 更新时间:2023-10-29 00:53:59 26 4
gpt4 key购买 nike

我只想 pull 。我有更改要忽略,我的 Gemfile 和 Gemlock 文件,我很乐意覆盖它们并 pull 。我试着把我的改变藏起来,这对我来说没有用。我该怎么办?

git pull
M Gemfile
U Gemfile.lock
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'.
~/projects/sms/apps2/apps2_admin(apps2)$ git stash save "saved"
Gemfile.lock: needs merge
Gemfile.lock: needs merge
Gemfile.lock: unmerged (4ea16799dba7bfe1db28adecf36dee1af5195c1a)
Gemfile.lock: unmerged (e77439c9f86d1d0eda7ae0787e3e158f90959e68)
Gemfile.lock: unmerged (d690d3860db1aa8e46c1bb2f4de3e52a297b5c26)
fatal: git-write-tree: error building trees
Cannot save the current index state
~/projects/sms/apps2/apps2_admin(apps2)$ git pull
M Gemfile
U Gemfile.lock
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 fetch origin
git reset --hard origin/master
git pull

解释:

  • Fetch 将从另一个存储库下载所有内容,在本例中,是标记为“来源”的存储库。
  • Reset 将放弃更改并恢复到存储库“origin”中提到的分支“master”。
  • Pull 只会从远程存储库中获取所有内容并进行集成。

请参阅 http://git-scm.com/docs 处的文档.

关于git - pull 是不可能的,因为你有未 merge 的文件,git stash 不起作用。不想犯,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8044675/

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