Quantcast
Channel: How do I delete a commit from a branch? - Stack Overflow
Viewing all articles
Browse latest Browse all 80

Answer by Agent_L for How do I delete a commit from a branch?

$
0
0

It's:

git rebase --onto commit_before commit_to_delete

eg. with following commits: A‑B‑C‑D, where A being the newest and D the most recent and HEAD, executing git rebase --onto A B results in A‑C'‑D', effectively "deleting" B.

Note that you can get rid of several commits in a row: git rebase --onto A C results in: A‑D'.


Viewing all articles
Browse latest Browse all 80

Trending Articles