git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: DeMarcus <demarcus@hotmail.com>
To: git@vger.kernel.org
Subject: Re: How can I do an automatic stash when doing a checkout?
Date: Sun, 18 Dec 2011 16:10:41 +0100	[thread overview]
Message-ID: <jckvpk$i8v$1@dough.gmane.org> (raw)
In-Reply-To: <84ty4ycdcc.fsf@cenderis.demon.co.uk>

>> 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.

  reply	other threads:[~2011-12-18 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18 11:19 How can I do an automatic stash when doing a checkout? DeMarcus
2011-12-18 11:45 ` Bruce Stephens brs
2011-12-18 15:10   ` DeMarcus [this message]
2011-12-18 15:37     ` Bruce Stephens brs
2011-12-19 16:18     ` Dirk Süsserott
2011-12-19 21:43       ` DeMarcus
2011-12-19 17:24     ` Holger Hellmuth
2011-12-19 21:46       ` DeMarcus
2011-12-19 22:24         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='jckvpk$i8v$1@dough.gmane.org' \
    --to=demarcus@hotmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).