From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Lukas Fleischer <lfleischer@lfos.de>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: tools for easily "uncommitting" parts of a patch I just commited?
Date: Sun, 23 Oct 2016 17:27:45 +0700 [thread overview]
Message-ID: <CACsJy8A2Q=cPhYtTexA+CS4mzyx-vHzNH033JFHDih=ohtucVw@mail.gmail.com> (raw)
In-Reply-To: <20161023013846.ct3olfabw2yhzio2@sigill.intra.peff.net>
On Sun, Oct 23, 2016 at 8:38 AM, Jeff King <peff@peff.net> wrote:
> On Sun, Oct 23, 2016 at 08:23:01AM +0700, Duy Nguyen wrote:
>
>> I hit the same problem sometimes, but in my case sometimes I
>> accidentally do "git add" after "git add -p" and a configuration in
>> "git commit -a" won't help me. I'd prefer we could undo changes in
>> index instead. Something like reflog but for index.
>
> An index write always writes the whole file from scratch, so you really
> just need to save a copy of the old file. Perhaps something like:
>
> rm -f $GIT_DIR/index.old
> ln $GIT_DIR/index.old $GIT_DIR/index
> ... and then open $GIT_DIR/index.tmp ...
> ... and then rename(index.tmp, index) ...
>
> could do it cheaply. It's a little more complicated if you want to save
> a sequence of versions, and eventually would take a lot of space, but
> presumably a handful of saved indexes would be sufficient.
Yeah. I had something [1] like that but never sorted out the UI for it :(
> Another option would be an index format that journals, and you could
> potentially walk back the journal to a point. That seems like a much
> bigger change (and has weird layering, because deciding when to fold in
> the journal is usually a performance thing, but obviously this would
> have user-visible impact about how far back you could undo).
v2 [2] goes in this direction (but not a full blown COW, the journal
does not take part in any core operations of the index)
[1] https://public-inbox.org/git/%3C1375597720-13236-1-git-send-email-pclouds@gmail.com%3E/
[2] https://public-inbox.org/git/1375966270-10968-1-git-send-email-pclouds@gmail.com/
--
Duy
prev parent reply other threads:[~2016-10-23 10:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 22:26 tools for easily "uncommitting" parts of a patch I just commited? Jacob Keller
2016-10-19 22:42 ` Jeff King
2016-10-19 23:36 ` Jacob Keller
2016-10-20 2:13 ` Jeff King
2016-10-20 5:53 ` Jacob Keller
2016-10-20 16:30 ` Junio C Hamano
2016-10-20 17:27 ` Jacob Keller
2016-10-20 17:39 ` Junio C Hamano
2016-10-20 18:13 ` Jacob Keller
2016-10-20 18:41 ` Junio C Hamano
2016-10-20 20:03 ` Jacob Keller
2016-10-22 9:19 ` Lukas Fleischer
2016-10-23 1:07 ` Jacob Keller
2016-10-23 1:23 ` Duy Nguyen
2016-10-23 1:38 ` Jeff King
2016-10-23 10:27 ` Duy Nguyen [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
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='CACsJy8A2Q=cPhYtTexA+CS4mzyx-vHzNH033JFHDih=ohtucVw@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=lfleischer@lfos.de \
--cc=peff@peff.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.
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).