git cherry-pick feature request

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

git cherry-pick feature request

From: Paul Mackerras <hidden>
Date: 2016-06-15 22:42:37

Junio,

I have added a feature on the "new" branch of gitk which allows the
user to cherry-pick commits on to the head of the current branch.
Currently I am using 'sh -c "git cherry-pick -r $id 2>&1"' for this.

The reason for the "2>&1" is that git cherry-pick writes stuff to
stderr even when there is no error, and the Tcl exec command assumes
that if the command writes to stderr that it failed somehow.

Also, if the merge fails, git cherry-pick leaves the commit partially
merged rather than restoring the original state.

Could I have a flag to git cherry-pick (-q for quiet, maybe) that
tells it not to print anything if the command succeeds?  Could I also
have a flag that tells it to clean up if the merge fails and leave the
tree in its previous state?

Or is there some other git command that already does all this that I
should use instead?

Thanks,
Paul.

Re: git cherry-pick feature request

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:37

Paul Mackerras [off-list ref] writes:
Could I have a flag to git cherry-pick (-q for quiet, maybe) that
tells it not to print anything if the command succeeds?  Could I also
have a flag that tells it to clean up if the merge fails and leave the
tree in its previous state?
Quiet sounds sane.

Reverting to its "previous state" I am not quite sure if it is
worth making it an option and run it as part of cherry-pick.

Re: git cherry-pick feature request

From: Paul Mackerras <hidden>
Date: 2016-06-15 22:42:37

Junio C Hamano writes:
Quiet sounds sane.

Reverting to its "previous state" I am not quite sure if it is
worth making it an option and run it as part of cherry-pick.
OK.  If the git cherry-pick terminates with an error I'll get gitk to
show the error message (if any) it printed along with a warning that
the working directory might need to be cleaned up.  I don't really
want to do a git reset automagically since the user might have local
modifications that they want to preserve.

While I'm asking for features, another one that would be really useful
for another tool I'm writing is a 3-way diff for a file between the
working directory, the index, and the current head commit, something
like what git diff-tree -c does for merges.  That is, it would have
two columns of +/-/space characters, one for the current head and one
for the index.  A '-' would indicate that the line appears in the
current head or the index but not in the version of the file in the
working directory.  A '+' would indicate that the line appears in the
working directory version.

How hard would it be to adapt the git diff-tree -c mechanism to work
on two blobs plus the file from the working directory?

Thanks,
Paul.

Re: git cherry-pick feature request

From: Jeff King <hidden>
Date: 2016-06-15 22:42:37

On Wed, Aug 23, 2006 at 11:07:33PM +1000, Paul Mackerras wrote:
While I'm asking for features, another one that would be really useful
for another tool I'm writing is a 3-way diff for a file between the
working directory, the index, and the current head commit, something
like what git diff-tree -c does for merges.  That is, it would have
Theoretically I'm working on this, but I haven't really had time to get
started on it yet this week. If you have patience, I'll get to it. If
not, then somebody else is welcome to take a crack at it.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help