Re: How can I do an automatic stash when doing a checkout?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Is there a way to have git checkout do an automatic stash 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?

You probably don't want to use stash. Just commit whatever partial work
you've done.


It feels strange doing a commit of partial work. Some of the files may not even be supposed to be checked in.

You could also just checkout different branches in different
directories. Nothing wrong with doing that in git.


Ok thanks, that would give me the same behavior as I have today.

However, I can see some benefits with have everything in the same directory as git allows compared to other VCSs. And since the stashing feature is already there in git, it would be nice if the git checkout with some flag could use stashing automatically.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]