拉不可能,因为你有未合并的文件,git stash不起作用.不想承诺

JZ.*_*JZ. 38 git gem ruby-on-rails git-stash git-pull

我只是想拉.我有更改无视,我的Gemfile和Gemlock文件,我很乐意只是覆盖它们而只是拉.我试着把我的变化藏起来,这对我来说没有用.我该怎么办?

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'.
Run Code Online (Sandbox Code Playgroud)

Ric*_*res 60

git fetch origin
git reset --hard origin/master
git pull
Run Code Online (Sandbox Code Playgroud)

说明:

  • Fetch将从另一个存储库下载所有内容,在本例中为标记为"origin"的存储库.
  • 重置将丢弃更改并恢复到存储库"origin"中提到的分支"master".
  • Pull将从远程存储库中获取所有内容并进行集成.

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

  • Fetch 将从另一个存储库下载所有内容,在本例中是标记为“origin”的存储库。重置将放弃更改并恢复到存储库“origin”中提到的分支“master”。Pull 只会从远程存储库获取所有内容并进行集成。请参阅 http://git-scm.com/docs/ 上的文档。 (2认同)

Amb*_*ber 39

您可以使用git checkout <file>签出文件的已提交版本(从而丢弃您的更改),或丢弃git reset --hard HEAD所有文件的任何未提交的更改.