> So, what simple and easy-to-use command does git offer to create a
> "negative commit"? That's to say, if I have commits A-B-C and want to
> "remove" B, how can I make git create a commit D for me such that
> A-B-C-D results in the same code as A-C?

https://www.kernel.org/pub/software/scm/git/docs/git-revert.html

> Anyway, I think it is a good idea to have a concrete
> example. I created a test repository, created ticket/123,
> ticket/456 and an identical copy ticket/456new of ticke/456.
> 
> The commits are
> - A: Introduces file bla
> - B: Introduces file blaB
> - C: Changes file bla
> - X: Changes file bla on top of commit C

> Branches master and ticket/123 is A-B-C, branches ticket/456 and
> ticket/456new are A-B-C-X
> 
> Result on ticket/123 = master
>   git log --oneline
>     202a495 Commit C
>     c7edaa0 Commit B
>     3c00aaf Commit A
>   ls
>     bla blaB
> 
> Then, I changed ticket/123 by
>   git reset --hard HEAD~2
> followed by 
>   git cherry-pick master
> 
> The result was
>   git log --oneline
>     e7d13cf Commit C
>     3c00aaf Commit A
>   ls
>     bla

OK, now we have

          A         B          C = master    X = ticket/456
o ------> o ------> o -------> o ----------> o
          |
          |
          +------------------> o
                               C' = ticket/123

I must say, I don't quite understand what it means that ticket/456 and
ticket/456new are identical? Do they correspond to the same (git-)sha1?


> Question to the git experts:
> - Is there an easy git command that creates a new commit reverting the
>   effects of a specified old commit (or series of old commits)?

I assume what you want as a result is this:

          A         B          C = master
o ------> o ------> o -------> o
          |
          |
          +------------------> o ---------------> o
                               C' = ticket/123    X = ticket/456


To achieve this from the above situation, you do

git rebase --onto ticket/123 master ticket/456

You can find some more information about "git rebase --onto" here.
(General rebasing starts at slide 148.)
http://www.slideshare.net/railsconf/smacking-git-around-advanced-git-tricks?src=related_normal&rel=2731503

Of course, instead of just X you could have several commits on top of
C(=master) leading to X. The command would be the same.

I hope, that is what you wanted.

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to