Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343072

Summary: During switching branches and Checkout, EGit should ask user what to do, if there are uncommited changes.
Product: [Technology] EGit Reporter: PaweÅ‚ <pawelec_p>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.duft, matthias.sohn, remy.suen, sam.davis, stefan.lay, steffen.pingel, stephan.herrmann
Version: unspecified   
Target Milestone: 2.1-M1   
Hardware: All   
OS: All   
Whiteboard:

Description Paweł CLA 2011-04-17 14:04:34 EDT
Build Identifier: 

1. There should be a option in EGit configuration: "Check uncommited files on branch switch/checkout"
2. If during branch switch EGit find uncomitted changes(even untracked ones), it should ask user for decision:
--a. Abort switch (don't do anything)
--b. stash changes and continue switch
--c. commit changes and continue switch
--d. leave changes uncommited and take them to branch XXX.

Stash is a future request, when it will be implemented in EGit.

Reproducible: Always

Steps to Reproduce:
1. Make some changes (on local branch), do not commit
2. Checkout another branch (local, based on same remote like in step 1)
3. Make some changes
4. Commit. It is possible to commit changes from step 1 together with those from step 3
Comment 1 Dani Megert CLA 2011-08-26 06:52:32 EDT
+1. Currently the dialog is not helpful and makes switching branches more heavyweight than it should be.
Comment 2 Markus Duft CLA 2012-01-17 08:26:08 EST
thats actually a git feature according to cgit man pages: if you accidentally worked on the wrong branch, and realize before committing, you can switch, and git will take the changes along. however i agree that this behaviour should be configurable.
Comment 3 Stephan Herrmann CLA 2012-04-02 07:25:04 EDT
+1

Especially a stash button on that dialog would be really cool.
Comment 4 Markus Duft CLA 2012-04-02 07:27:13 EDT
this button already exists on master :)
Comment 5 Stephan Herrmann CLA 2012-04-14 10:54:41 EDT
EGit 2.0.0.201204130249

I just tried the "Reset ..." option, selected "hard" and it seems it *only* performed the reset, but not the checkout. I didn't try to reproduce though.

May we expect the final behavior to do the selected [reset/commit/stash] and then *continue* with the checkout?
Comment 6 Matthias Sohn CLA 2012-07-09 03:33:40 EDT
yes, it should continue after the selected action to remove uncommitted changes has finished.
Comment 7 Stephan Herrmann CLA 2012-07-09 15:29:57 EDT
(In reply to comment #6)
> yes, it should continue after the selected action to remove uncommitted changes
> has finished.

Cool, looking forward to the fix :)
Comment 8 Stefan Lay CLA 2012-08-20 09:29:19 EDT
*** Bug 385245 has been marked as a duplicate of this bug. ***
Comment 9 Stefan Lay CLA 2012-08-21 06:45:29 EDT
Fix proposed: https://git.eclipse.org/r/#/c/7321/
Comment 10 Matthias Sohn CLA 2012-08-22 17:12:41 EDT
merged as ed119527f1d30405bdf8d891206a49c0f4933f35