Tuesday, December 15, 2015

GIT - How to drop a commit in the middle of branch

Say, I have a branch:
O --> A --> D --> B --> C           master

and I want to make it

O --> A --> B --> C            master

If changing the hashes is not a problem, meaning you haven't pushed, or knowning no one else has checked out the branch (although very unlikely for master branch), could do this:

git rebase --onto A D C

Note that since then, hashes on B C are changed.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home