login
Header Space

 
 

Re: [PATCH] git-revert is one of the most misunderstood command in git, help users out.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Johannes Schindelin <Johannes.Schindelin@...>
Cc: Steven Grimm <koreth@...>, Pierre Habouzit <madcoder@...>, <git@...>
Date: Tuesday, November 6, 2007 - 7:08 am

Junio C Hamano <gitster@pobox.com> writes:


As Pierre said earlier, a partial revert via "revert <commit> --
<paths>" and a partial cherry-pick would make quite a lot of
sense, and in addition, it should not be too hard to add.

Reusing the 'merge-recursive' part should be almost trivial.
The only tricky part is coming up with a fake tree using base
and next commit in revert_or_cherry_pick() for this purpose.

When replaying the change from A->B (when cherry-picking, A is
the parent and B is what was named from the command line; when
reverting, they are the other way around), instead of doing the
three-way merge using:

	merge-recursive A HEAD B

you would first come up with a modified tree B' that has the
identical contents to A _except_ the parts the path limiters
specify which are taken from B.  Then running

	merge-recursive A HEAD B'

would replay the revert or cherry-pick of change from A->B,
limited by the path, on top of the current HEAD.

As to "reverting to the index" case, if somebody is interested
in doing a builtin-checkout.c, please keep in mind that major
parts of that work should be made available to the
implementation of "git revert [--] <paths>", as it appears that
it will be exactly the same as "git checkout" with the same set
of options.

I am wondering what "git cherry-pick -- <paths>" should do.  My
current thinking is that it would not make any sense at all.


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Mon Nov 5, 7:40 pm)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Junio C Hamano, (Tue Nov 6, 7:08 am)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Tue Nov 6, 8:25 am)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Tue Nov 6, 8:16 am)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Mon Nov 5, 11:18 pm)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Tue Nov 6, 8:32 am)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Tue Nov 6, 6:25 pm)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Wed Nov 7, 7:08 am)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Tue Nov 6, 2:27 pm)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Johannes Schindelin, (Tue Nov 6, 6:21 pm)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Alejandro Martinez Ruiz, (Mon Nov 5, 5:54 pm)
Re: [PATCH] git-revert is one of the most misunderstood comm..., Alejandro Martinez Ruiz, (Mon Nov 5, 7:41 pm)
speck-geostationary