I have a branch called feature and it has a few commits. The branch and its commits are still local to my machine (haven’t been pushed to a public repository). The graph looks like
A---B---C---D---E---F---G master
\
P---Q---R feature
Now I realized that I should’ve made the branch feature off of an earlier commit on master. Let’s say commit C. In other words, the graph should look like
A---B---C---D---E---F---G master
\
P---Q---R feature
What I am trying to do in essence is revert commits D, E and F out of the feature branch. Yes, I could just revert commits one at a time but there are too many to revert; the above picture is just an illustration.
What you want to do is a rebase. To pick up the commits
P,QandRand apply them on top ofC, you execute:See the man-page of
git-rebasefor more information.