0

I'm trying to push my Rails project to Heroku, but Git isn't allowing me to do anything at the moment. Here's what I've done so far:

  • git push heroku failed because the heroku branch was "ahead" of my local branch, which should not have been possible.
  • I pulled and there was a conflict with .idea/workspace.xml. I wasn't able to find out what that file is, but it's huge and Git wrote all kinds of garble to it. Too much to manually "resolve" conflicts.
  • I saw some stackoverflow posts talking about git-ignoring that file (maybe it's some IDE file for RubyMine or something?), so I tried to move the file away to avoid the conflict
  • I ran git add -A (also tried git add . and git add)
  • git commit --amend fails because "You are in the middle of a merge"
  • git merge --abort fails because "Untracked working tree file '.idea/workspace.xml' would be overwritten by merge (despite the fact that the file has been moved)
  • git reset --merge fails for the same reason.

How can I make Git work again?

Atte Juvonen
  • 4,922
  • 7
  • 46
  • 89

3 Answers3

3

.idea/workspace.xml

This file is your idea workspace files. They are generated by IntelliJ tools.

I saw some stackoverflow posts talking about git-ignoring that file (maybe it's some IDE file for RubyMine or something?), so I tried to move the file away to avoid the conflict

Simply add the folder to your .gitignore but since its already committed you will have to remove it from the repository:

# Quit the merge
git merge --abort

# remove the whole folder from the repo
git rm -rf --cached .idea/

# add it to the .gitignore: idea/

# add and commit your changes
git add .- A
git commit -m " Removed idea folder"

git push origin <branch> 

If you still unable to do it?

First reset the code to the previous state and then do the above code again.
The reset will take you to your last commit before the pull

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
0

git commit -am "message" worked (as opposed to amending a commit)

Atte Juvonen
  • 4,922
  • 7
  • 46
  • 89
  • Note that this committed the merge, and since you removed `.idea/workspace.xml` and then ran `git add -A` before the commit, you also removed it from the repository. That may be what you want anyway, since you plan to ignore the file. But I would look at what commits you merged in since you think it should have been "impossible" that the remote repo was ahead of yours. – David Deutsch Feb 18 '16 at 19:24
  • Workspace.xml was the only file I merged in, and I removed it before committing. Thanks for helping out. – Atte Juvonen Feb 18 '16 at 19:52
0

I have resolved a similar problem by simply deleting the workspace.xml file. By building and running the program again idea will autogenerate a compatible file.

YuhaoHanHarry
  • 61
  • 1
  • 6