git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Chris Torek <chris.torek@gmail.com>
Cc: Tim Chase <git@tim.thechases.com>,  git@vger.kernel.org
Subject: Re: Stashing just index..working-copy rather than HEAD..working-copy?
Date: Wed, 24 Apr 2024 16:31:37 -0700	[thread overview]
Message-ID: <xmqq1q6uwd5y.fsf@gitster.g> (raw)
In-Reply-To: <CAPx1GvcxyDDQmCssMjEnt6JoV6qPc5ZUpgPLX3mpUC_4PNYA1w@mail.gmail.com> (Chris Torek's message of "Wed, 24 Apr 2024 15:17:41 -0700")

Chris Torek <chris.torek@gmail.com> writes:

> With all that said, I'd like to make one last suggestion, which
> I think is a lot simpler: *stop using `git stash`*.  Just make
> a commit!

;-)

If I recall correctly, the original design of "git stash" was "I
save everything in the working tree, so that I can start working on
an urgent request immediately, and then later restore everything",
and there was no "--index" option for application, even though the
stash entries were the W commit that is a merge of the I (index)
commit and the B (base) commit.  The "apply/pop --index" was a mere
afterthought that does not work very well and made things more
confusing.  It wasn't meant to be used in anything complex, for
which a separate branch with real commits were the way to go.

There were some reasons (like, working tree side post-commit hooks
that are not well written to distinguish temporary commits from real
ones and send out notifications outside) that some folks wanted to
avoid making a commit on a temporary branch and to them, having a
bit more complex "stash" may have been a way for them to avoid
triggering those poorly designed workflow around post-commit hooks.
But with modern Git in this age with workflows and disciplines
better understood, I agree that we should encourage use of more
temporary branches with real commits.  If there are reasons to cause
developers fear of commitment (e.g., "my $CORP environment forces me
to show every commit I make to CI server, which slows me down and
wastes resources if I make many tentative commits only for
snapshot"), they should be solved in a way that users do not have to
fear commitments.

Thanks.





  reply	other threads:[~2024-04-24 23:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 13:44 Stashing just index..working-copy rather than HEAD..working-copy? Tim Chase
2024-04-24 22:17 ` Chris Torek
2024-04-24 23:31   ` Junio C Hamano [this message]
2024-04-27 20:17   ` Tim Chase

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=xmqq1q6uwd5y.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chris.torek@gmail.com \
    --cc=git@tim.thechases.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).