From: Jeff King <peff@peff.net>
To: David Aguilar <davvid@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Sven Strickroth <sven@cs-ware.de>,
git@vger.kernel.org
Subject: Re: RFC: git status --amend
Date: Fri, 3 Apr 2015 18:05:46 -0400 [thread overview]
Message-ID: <20150403220546.GA14195@peff.net> (raw)
In-Reply-To: <20150403215744.GA39695@gmail.com>
On Fri, Apr 03, 2015 at 02:57:48PM -0700, David Aguilar wrote:
> > But I discarded it as a useless suggestion before writing it down,
> > primarily because I couldn't come up with an explanation _why_ being
> > able to say "git status --relative-to=next Makefile" is useful when
> > on the 'master' branch.
>
> Aesthetically it's appealing because it mirrors commands like
> "git diff HEAD^", etc.
>
> I can see it being useful for script writers but it's a minority
> case that's already handled by having "status --amend" for the
> common case of needing to mimic "commit --amend".
>
> Beyond that use case, someone could use it to write a butchery
> tool that gets a quick high-level diff of changes for both index
> and worktree against an arbitrary ref, and then apply those
> changes selectively using other git tools.
Hmm. What if you had a tool that created commits out of an alternate
working tree and index, and then committed directly to a branch without
touching HEAD? Then you might run:
GIT_WORK_TREE=... GIT_INDEX_FILE=... git status --relative-to=mybranch
right before running:
old=$(git rev-parse refs/heads/mybranch) &&
tree=$(GIT_INDEX_FILE=... git commit-tree) &&
commit=$(echo whatever | git commit-tree -p $old $tree) &&
git update-ref refs/heads/mybranch $old
or similar. That is basically "git-new-workdir", but with no per-workdir
HEAD. Which is probably crazy, but maybe useful for a one-off commit to
another branch or something.
I dunno. I do not have such a tool or plan to work on one, but it is at
least plausible to me.
-Peff
prev parent reply other threads:[~2015-04-03 22:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 14:59 RFC: git status --amend Sven Strickroth
2015-03-31 18:04 ` Jeff King
2015-03-31 18:35 ` Junio C Hamano
2015-04-01 8:43 ` David Aguilar
2015-04-01 17:16 ` Junio C Hamano
2015-04-03 21:57 ` David Aguilar
2015-04-03 22:05 ` Jeff King [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=20150403220546.GA14195@peff.net \
--to=peff@peff.net \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sven@cs-ware.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.