From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Blake Campbell <bc@mpbell.io>, git@vger.kernel.org
Subject: Re: skip-worktree autostash on pull
Date: Thu, 14 Sep 2023 14:53:40 -0700 [thread overview]
Message-ID: <xmqq7cosifq3.fsf@gitster.g> (raw)
In-Reply-To: <ZQN9Azt/K28WLfqH@tapette.crustytoothpaste.net> (brian m. carlson's message of "Thu, 14 Sep 2023 21:37:07 +0000")
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> Your particular case is one of many reasons we suggest this approach.
> There is in fact an --autostash argument in git pull, as well as git
> rebase, both of which work as you might expect, but in general they
> still won't work properly with --skip-worktree and given the FAQ entry
> above, we wouldn't add support for that in the option.
As you mentioned, "--autostash" will move away the local change
while your otherwise clean working tree needs to be updated from the
upstream via "git pull" (or "git pull --rebase"). So the only thing
the user may want to be careful would be "git commit -a" (and "git
add -u"), I would think. A pre-commit hook should be able to stop
you from committing with local changes to these selected paths you
want to keep following the upstream _with_ local changes (i.e. run
"diff --cached --name-only HEAD" and exit with non-zero when one of
these paths appear in its output). Upon seeing such a failure, you
can "git stash" the changes, then "git commit" again. And you do
not need to abuse assume-unchanged or skip-worktree for doing that.
prev parent reply other threads:[~2023-09-14 21:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 9:54 skip-worktree autostash on pull Blake Campbell
2023-09-14 21:37 ` brian m. carlson
2023-09-14 21:53 ` Junio C Hamano [this message]
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=xmqq7cosifq3.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bc@mpbell.io \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/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).