+3 votes
1 view
in DevOps and Agile by (20k points)
edited by

I have a git repository that looks like this:

A -> B -> C -> D -> HEAD

I want the head of the branch to point to A, i.e. I want B, C, D, and HEAD to disappear and I want head to be synonymous with A.

It sounds like I can either try to rebase (doesn't apply, since I've pushed changes in between), or revert. But how do I revert multiple commits? Do I revert one at a time? Is the order important?

1 Answer

+3 votes
by (28.4k points)

The following command will revert the last 3 commits with only one commit.  

$ git revert --no-commit HEAD~3..    

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...