Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » can not switch to another branch
can not switch to another branch [message #1404678] Tue, 05 August 2014 01:38 Go to next message
ken wong is currently offline ken wongFriend
Messages: 4
Registered: August 2014
Junior Member
When i switch to another branch,eclipse shows a message "The files shown below have uncommitted changes which would be lost by checking out my branch.Either commit the changes,stash the changes,or discard the changes by resetting the current branch".
but all the files are in the target folder which is created by maven.And when i click reset, it still shows the same dialog.
Re: can not switch to another branch [message #1404694 is a reply to message #1404678] Tue, 05 August 2014 07:14 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1072
Registered: July 2009
Senior Member
Looks like you have committed build results so that they are now tracked in Git's version history.
To fix that use EGit's command "Team > Advanced > Untrack" to stop versioning these files and
commit this using the staging view (can't be done from commit dialog since it's ignoring the index).
Re: can not switch to another branch [message #1404695 is a reply to message #1404694] Tue, 05 August 2014 07:14 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1072
Registered: July 2009
Senior Member
And then add the target folder to .gitignore in order to prevent that you commit build results again
Re: can not switch to another branch [message #1442646 is a reply to message #1404678] Sat, 11 October 2014 12:28 Go to previous messageGo to next message
Andrew Ducker is currently offline Andrew DuckerFriend
Messages: 2
Registered: June 2013
Junior Member
I'm also getting this problem - with a slightly difference cause.

I have a branch "master" that tracks a load of files. I have a branch one which I have stopped tracking one of those files (and added it to the .gitignore).

When I try to switch back to master it tells me that this file has uncommitted changes which would be lost by checking out master.

There are three options:
"Commit..." - which tells me there is nothing to commit, and brings me back to the dialog.
"Stash..." - which tells me there is nothing to stash, and brings me back to the dialog.
"Reset" - which just brings me back to the dialog.

How do I persuade EGit that it's fine to lose the changes in this file _because I'm not tracking it any more_?

Andy
Re: can not switch to another branch [message #1446382 is a reply to message #1442646] Thu, 16 October 2014 19:20 Go to previous message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
Andrew Ducker skrev 2014-10-11 14.28:
> I'm also getting this problem - with a slightly difference cause.
>
> I have a branch "master" that tracks a load of files. I have a branch one which I have stopped tracking one of those files (and added it to the .gitignore).
>
> When I try to switch back to master it tells me that this file has uncommitted changes which would be lost by checking out master.
>
> There are three options:
> "Commit..." - which tells me there is nothing to commit, and brings me back to the dialog.
> "Stash..." - which tells me there is nothing to stash, and brings me back to the dialog.
> "Reset" - which just brings me back to the dialog.
>
> How do I persuade EGit that it's fine to lose the changes in this file _because I'm not tracking it any more_?

You need to delete the files and commit the deletion. Team>Advanced>Assume unchanged might also help, but that state is
volatile so once a file disappears ans the reaappears that setting is lost.

-- robin
Previous Topic:Could not add menu item to Egit history View menu
Next Topic:Eclipse Kepler/Luna IDE for Java EE Developers & Egit
Goto Forum:
  


Current Time: Mon Aug 19 05:25:05 GMT 2019

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

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

Back to the top