potentially risk during branch switch [message #662779] |
Thu, 31 March 2011 22:00 |
Pawel Messages: 10 Registered: March 2011 |
Junior Member |
|
|
I have Egit/JGit plugin 0.11.3, eclipse 3.5.2.
I create local branch (eg "masterTask1") on base of remote branch (eg "master").
Next I create second branch (eg "masterTask2") on base of the same remote branch ("master").
I checkout "masterTask1", make some changes in files, and then I checkout "masterTask2". After this I still can see changes I made in "masterTask1" !!!
Eclipse even not warn me, that there are some uncomitted changes.
This problem not happens when branches are created on different remote branches, only when they are on the same remote branch.
Best regards
Pawel
[Updated on: Thu, 14 April 2011 21:17] Report message to a moderator
|
|
|
|
Re: critical bug in local branch [message #665519 is a reply to message #665507] |
Thu, 14 April 2011 21:16 |
Pawel Messages: 10 Registered: March 2011 |
Junior Member |
|
|
Thank you for response.
You right, thats the way how native git works.
So it's not a bug.
But...I think it is a place for potentially mistakes.
I think there is a very big risk, not to notice those changes and commit them accidentialy in incorrect branch.
I think taht icon or color on branch name, sygnalizing status (git status) would be great. I could then, easy check if there are any uncommited changes, and not to switch.
By the way
If you don't want your changes stays in workspace during switch, you need to use: "git stash" before switch. But there is a risk, that stash not hide unstaged changes....
And Egit not support stash...
Best regards
Paweł.
PS. I changed title of this topic and added feature request:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341588
[Updated on: Thu, 14 April 2011 21:35] Report message to a moderator
|
|
|
Re: critical bug in local branch [message #665784 is a reply to message #665519] |
Fri, 15 April 2011 22:17 |
Robin Rosenberg Messages: 332 Registered: July 2009 |
Senior Member |
|
|
On 2011-04-14 23.16, Pawel wrote:
> Thank you for response.
> You right, thats the way how native git works.
> So it's not a bug.
>
> But...I think it is a place for potentially mistakes.
> I think there is a very big risk, not to notice those changes and commit
> them accidentialy in incorrect branch.
>
> I think taht icon or color on branch name, sygnalizing status (git
> status) would be great. I could then, easy check if there are any
> uncommited changes, and not to switch.
>
> By the way
> If you don't want your changes stays in workspace during switch, you
> need to use: "git stash" before switch. But there is a risk, that stash
> not hide unstaged changes....
> And Egit not support stash...
I think it would be a good idea for EGit to ask the user what to do when
there are uncommitted changes, even untracked ones and allow the user to
stash, commit, discard or bring along changes.
-- robin
|
|
|
Re: critical bug in local branch [message #665787 is a reply to message #665784] |
Fri, 15 April 2011 22:49 |
Pawel Messages: 10 Registered: March 2011 |
Junior Member |
|
|
Robin, its really good idea.
So, I try to describe solution.
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, 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 ang take them to branch XXX.
I know, that stash is not supported now, so it could be feature for far future.
By the way, I have just started friendship with git in my company. My colleagues are serious frightened about accidentialy commit files to incorrect branch after branch switch.
Best regards.
Paweł
[Updated on: Fri, 15 April 2011 22:51] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03667 seconds