git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Brian Scott Dobrovodsky <brian@pontech.com>
Cc: git@vger.kernel.org
Subject: Re: Data Integrity & un-Commited Branches
Date: Sat, 15 Sep 2007 02:32:57 -0400	[thread overview]
Message-ID: <20070915063257.GZ3099@spearce.org> (raw)
In-Reply-To: <2a8a071a0709142324i29a863b7x8c164a589c1f1f9a@mail.gmail.com>

Brian Scott Dobrovodsky <brian@pontech.com> wrote:
> > It isn't unreasonable to want Git to save uncommitted work for the
> > current branch and then you switch to another, ending up with a
> > clean working directory when you finally get there.  Today we have
> > git-stash to help you with this, but I'm thinking maybe we want to
> > connect git-checkout with it?
> 
> That would be great as a default action when using checkout!

Well, a lot of "Git old timers" like the current action of keeping
the tree dirty during a switch.  But maybe we could also teach `git
checkout` that a user specified configuration option can cause it
to automatically stash/unstash unless -m is supplied.  Or something.

Patches are always welcome.  ;-)

> +Switching branches without having to commit improves work flow.
> +Fewer commits = cleaner logs.

Well, I'm not sure that matters here.  Typically Git users will make
heavy use of commit rewriting features (e.g. `git commit --amend`
or `git rebase -i`) to cleanup changes on a side branch before they
submit them to the mainline.  This makes it easy to commit all of
the time and not worry about how the resulting logs will look.
Plus they can have look like they have some serious code-fu and
always write things perfectly the first time. :)

Indeed, before git-stash came about I parked changes on a branch
using the following technique:

	$ git commit -a -m PARK       ; # stash on "demo"
	$ git checkout master         ; # tree is now clean
	$ git checkout demo           ; # back on demo
	$ git reset --soft HEAD^      ; # undo the stash

No messy history, nice neat per-branch stash.  Oh, you can do that
in Git 1.3.  And even earlier probably.  I actually still use this
trick from time to time as I find it flowing out of my fingers far
easier than git-stash.

-- 
Shawn.

  reply	other threads:[~2007-09-15  6:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2a8a071a0709140028o472bcr8c82bd88e37cc4e9@mail.gmail.com>
     [not found] ` <2a8a071a0709140036l5db62c0fl5af01f75f35610ba@mail.gmail.com>
     [not found]   ` <7vk5qtd3le.fsf@gitster.siamese.dyndns.org>
2007-09-15  0:40     ` Data Integrity & un-Commited Branches Brian Scott Dobrovodsky
2007-09-15  2:51       ` Shawn O. Pearce
2007-09-15  6:24         ` Brian Scott Dobrovodsky
2007-09-15  6:32           ` Shawn O. Pearce [this message]
2007-09-15  6:37           ` Junio C Hamano
2007-09-15  7:14             ` Brian Scott Dobrovodsky
2007-09-15  7:38         ` Jan Hudec
2007-09-15  7:51           ` Shawn O. Pearce
2007-09-15 13:11             ` Nikodemus Siivola
2007-09-15 13:59               ` David Kastrup
2007-09-15 17:14                 ` Nikodemus Siivola
2007-09-15 17:33                   ` David Kastrup

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20070915063257.GZ3099@spearce.org \
    --to=spearce@spearce.org \
    --cc=brian@pontech.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).