Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Egit can't revert commit because local changes to .classpath
Egit can't revert commit because local changes to .classpath [message #1798115] Mon, 12 November 2018 18:26 Go to next message
Bob Busby is currently offline Bob BusbyFriend
Messages: 2
Registered: November 2018
Junior Member
A team member converted our shared project from java 1.7 to java 1.8. For some reason, when I pulled the master, I did not get his .classpath or .settings changes, just his code changes, and a lot of stuff wouldn't compile.

I created a branch, then modified the build path and project facet so that things would compile again. I added some changes, committed and pushed. So far so good.

Then a few days later I checked out the master and did a pull and found myself back in a java 1.7 compiler environment with a bunch of files that wouldn't compile. Here I made my fatal mistake. Instead of just merging my new branch, I decided to "fix it". I modified the build path and project facet and etc. Then committed and pushed to the master. (ugh, I should never do that)

Then I tried to merge my new branch again and all my changes got flagged as conflicts. So now I want to just revert the last commit to my master branch, go back to that one (with all the compiler errors) and merge my new branch in (which presumably will contain the .classpath and .settings needed to get back to my java 1.8 compiler).

But when I try to revert the commit, eclipse tells me I can't because of "local changes to .classpath". In desperation, I did an "overwrite" of .classpath to bring in the old changes, but I still can't revert my last commit.

I'm not sure what to do next. Any ideas?
Re: Egit can't revert commit because local changes to .classpath [message #1798292 is a reply to message #1798115] Thu, 15 November 2018 02:50 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 617
Registered: July 2009
Senior Member
I'm pretty sure it's a big mistake to check in the .classpath file, or actually any eclipse dot files. You might have to remove it with command-line git and refresh, and that might straighten you out.
Re: Egit can't revert commit because local changes to .classpath [message #1798624 is a reply to message #1798292] Wed, 21 November 2018 09:40 Go to previous messageGo to next message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 174
Registered: August 2016
Senior Member
David M. Karr wrote on Thu, 15 November 2018 02:50
I'm pretty sure it's a big mistake to check in the .classpath file...


That advice is definitely wrong. It'd be a big mistake not to check in the .classpath file. (Or the build files like manifests, poms, and so on.)

For other IDE specific files and directories like .project, .idea, .settings, and so on, opinions differ, but I think it's generally a good idea to check those in, too. Otherwise someone cloning the repo will not get the IDE setup. If you want some consistency, you'd want all committers use consistent formatting, style checking, and static analysis settings, otherwise your repo ends up in a mess.

As to the OP's question: sorry, but from that description I cannot tell where the problem might be. Without being able to see what is actually on your computer it's nigh impossible to figure out what is going on. I should hope there is somebody in your team with enough git experience to help you straighten out your problems interactively.
Re: Egit can't revert commit because local changes to .classpath [message #1798939 is a reply to message #1798624] Tue, 27 November 2018 17:15 Go to previous message
Bob Busby is currently offline Bob BusbyFriend
Messages: 2
Registered: November 2018
Junior Member
I can't remember how I fixed this - some combination of hard reset and manually deleting the "." files, but I finally fooled eclipse into allowing me to back out my commit. It wasn't easy, or in any way intuitive, and may the deities help me should it become necessary again.
Previous Topic:EGit compile: org.eclipse.jgit.repository missing
Next Topic:Reset to previous commit and push
Goto Forum:
  


Current Time: Mon Dec 09 15:02:58 GMT 2019

Powered by FUDForum. Page generated in 0.01678 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top