Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull is not possible because you have unmerged files, git stash doesn't work. Don't want to commit

I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I'd be happy to just overwrite them and just pull. I tried stashing my changes away, this didn't work out for me. What do I do?

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'. 
like image 429
JZ. Avatar asked Nov 08 '11 00:11

JZ.


People also ask

How do you fix committing is not possible because you have unmerged files?

error: merge is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm <file>' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict.

What is unmerged files in git?

to discard changes in working directory) # # unmerged: <file> # "Changes to be committed": All committed changes to files that are not affected by the conflict are staged. "Changed but not updated ... unmerged": All files that have conflicts that must be resolved before repository will be back to working order.

Is it possible to unmerged files git?

Git Pull is Not Possible, Unmerged Files.


2 Answers

git fetch origin git reset --hard origin/master git pull 

Explanation:

  • Fetch will download everything from another repository, in this case, the one marked as "origin".
  • Reset will discard changes and revert to the mentioned branch, "master" in repository "origin".
  • Pull will just get everything from a remote repository and integrate.

See documentation at http://git-scm.com/docs.

like image 150
Ricardo Peres Avatar answered Sep 21 '22 13:09

Ricardo Peres


You can use git checkout <file> to check out the committed version of the file (thus discarding your changes), or git reset --hard HEAD to throw away any uncommitted changes for all files.

like image 30
Amber Avatar answered Sep 24 '22 13:09

Amber