Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Will EGit support automatic stash when doing a checkout?
Will EGit support automatic stash when doing a checkout? [message #767564] Sun, 18 December 2011 10:38 Go to next message
Eclipse UserFriend
Hi,

I see that EGit 1.3 will support git stash:

https://bugs.eclipse.org/bugs/attachment.cgi?id=208386
(look at the second last slide)

Currently I'm working with SVN and there it's a bit messier doing
branching but once I've branched all my development there is completely
separated from any other branch. When I want to work on another branch I
just change directory.

This is not how it works with git where when I want to change branch I
have to do a git checkout. However, that leaves all the modified and
untracked files in the directory of the branch I switched to. This is
seldom the behavior I want.

With the git stash command I can clean the directory the way I want but
the stash command is not connected to a particular branch.

Will EGit 1.3 be able to stash automatically when doing a checkout to
another branch, and then do an automatic git stash apply with the
correct stash when changing back to the previous branch again?

Thanks,
Daniel
Re: Will EGit support automatic stash when doing a checkout? [message #768131 is a reply to message #767564] Mon, 19 December 2011 16:21 Go to previous messageGo to next message
Kevin Sawicki is currently offline Kevin SawickiFriend
Messages: 47
Registered: September 2011
Member
Yes, I believe that is one such scenario EGit will try to support, associating stashes with branches allowing you to switch branches and access your stashed work for that branch. And also prompt to stash or automatically stash when switching branches cannot be done due to conflicts in the working directory between branches.

Only the JGit work has been started for this feature, once that is committed then the tooling in EGit will progress. I would recommend getting on the 1.3 nightlies once they are available and provide feedback/ideas as the feature evolves.
Re: Will EGit support automatic stash when doing a checkout? [message #768303 is a reply to message #768131] Mon, 19 December 2011 22:01 Go to previous messageGo to next message
Eclipse UserFriend
On 2011-12-19 17:22, Kevin Sawicki wrote:
> Yes, I believe that is one such scenario EGit will try to support,
> associating stashes with branches allowing you to switch branches and
> access your stashed work for that branch. And also prompt to stash or
> automatically stash when switching branches cannot be done due to
> conflicts in the working directory between branches.
>
> Only the JGit work has been started for this feature, once that is
> committed then the tooling in EGit will progress. I would recommend
> getting on the 1.3 nightlies once they are available and provide
> feedback/ideas as the feature evolves.

Ok, thanks!

Actually I have one more feature suggestion already now.

When checking out another branch it would be a great feature if it could
also automatically change the set of source files I currently have
opened in the editor. I.e. the currently opened files are connected to
which branch is current, so when another branch is checked out then
first all files are closed and the files that were open last time the
other branch was checked out will be reopened in the editor.

The only way to get the same behavior today is to change the whole
workspace, but that doesn't work practically.
Re: Will EGit support automatic stash when doing a checkout? [message #768307 is a reply to message #767564] Mon, 19 December 2011 22:21 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
DeMarcus skrev 2011-12-18 11.38:
> Hi,
>
> I see that EGit 1.3 will support git stash:
>
> https://bugs.eclipse.org/bugs/attachment.cgi?id=208386
> (look at the second last slide)
>
> Currently I'm working with SVN and there it's a bit messier doing branching but once I've branched all my development there is completely separated from any other branch.
> When I want to work on another branch I just change directory.
>
> This is not how it works with git where when I want to change branch I have to do a git checkout. However, that leaves all the modified and untracked files in the directory
> of the branch I switched to. This is seldom the behavior I want.
>
> With the git stash command I can clean the directory the way I want but the stash command is not connected to a particular branch.
>
> Will EGit 1.3 be able to stash automatically when doing a checkout to another branch, and then do an automatic git stash apply with the correct stash when changing back to
> the previous branch again?

EGit (JGit) automaticall carry changes over a checkout, just like C Git, but it does not allow this if there would be
a conflict.

-- robin
Re: Will EGit support automatic stash when doing a checkout? [message #768319 is a reply to message #768303] Mon, 19 December 2011 22:45 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
DeMarcus skrev 2011-12-19 23.01:
> On 2011-12-19 17:22, Kevin Sawicki wrote:
>> Yes, I believe that is one such scenario EGit will try to support,
>> associating stashes with branches allowing you to switch branches and
>> access your stashed work for that branch. And also prompt to stash or
>> automatically stash when switching branches cannot be done due to
>> conflicts in the working directory between branches.
>>
>> Only the JGit work has been started for this feature, once that is
>> committed then the tooling in EGit will progress. I would recommend
>> getting on the 1.3 nightlies once they are available and provide
>> feedback/ideas as the feature evolves.
>
> Ok, thanks!
>
> Actually I have one more feature suggestion already now.
>
> When checking out another branch it would be a great feature if it could also automatically change the set of source files I currently have opened in the editor. I.e. the
> currently opened files are connected to which branch is current, so when another branch is checked out then first all files are closed and the files that were open last
> time the other branch was checked out will be reopened in the editor.
>
> The only way to get the same behavior today is to change the whole workspace, but that doesn't work practically.
>

This might interest you: https://bugs.eclipse.org/bugs/show_bug.cgi?id=309578

-- robin
Re: Will EGit support automatic stash when doing a checkout? [message #768348 is a reply to message #768303] Tue, 20 December 2011 00:17 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
AFAIK Mylyn could help with opening the files corresponding to a given task if you switch mylyn tasks when switching branches
Re: Will EGit support automatic stash when doing a checkout? [message #768681 is a reply to message #768319] Tue, 20 December 2011 15:44 Go to previous message
Eclipse UserFriend
On 12/19/2011 11:45 PM, Robin Rosenberg wrote:
> DeMarcus skrev 2011-12-19 23.01:
>> On 2011-12-19 17:22, Kevin Sawicki wrote:
>>> Yes, I believe that is one such scenario EGit will try to support,
>>> associating stashes with branches allowing you to switch branches and
>>> access your stashed work for that branch. And also prompt to stash or
>>> automatically stash when switching branches cannot be done due to
>>> conflicts in the working directory between branches.
>>>
>>> Only the JGit work has been started for this feature, once that is
>>> committed then the tooling in EGit will progress. I would recommend
>>> getting on the 1.3 nightlies once they are available and provide
>>> feedback/ideas as the feature evolves.
>>
>> Ok, thanks!
>>
>> Actually I have one more feature suggestion already now.
>>
>> When checking out another branch it would be a great feature if it
>> could also automatically change the set of source files I currently
>> have opened in the editor. I.e. the
>> currently opened files are connected to which branch is current, so
>> when another branch is checked out then first all files are closed and
>> the files that were open last
>> time the other branch was checked out will be reopened in the editor.
>>
>> The only way to get the same behavior today is to change the whole
>> workspace, but that doesn't work practically.
>>
>
> This might interest you:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=309578
>

Yes, the post from Chris Beams 2011-03-18 was something close to what
I'm looking for. However, it would be nice to have EGit do the stash
when switching *branch* so I'm not forced to use Mylyn.

Also, with git 1.7.7 you can stash untracked files without staging them.
Using that we would have a very clean branch switching.

http://stackoverflow.com/questions/835501/git-how-do-you-stash-an-untracked-file


/Daniel
Previous Topic:Commit takes too long time
Next Topic:EGit and linked folders in eclipse
Goto Forum:
  


Current Time: Fri Apr 19 22:58:04 GMT 2024

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

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

Back to the top