Quantcast
Viewing latest article 42
Browse Latest Browse All 80

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

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 latest article 42
Browse Latest Browse All 80

Trending Articles