Jordi
Jordi

Reputation: 23207

How to remove commit and not merged branch

I'd like to remove a branch which contains only one commit. This branch has not never merged.

This is the log:

* 3554555 - (6 days ago) SHA-1 to SHA-2
* 6526045 - (6 days ago) swagger updated
| * f9026f1 - (5 days ago) Using LocalDateTime (HEAD -> dates)
|/  
* bf2c6c2 - (6 days ago) Collect request parameters on audit

So, I'd like to remove this orphan dates branch and its commit f9026f1.

Any ideas?

Upvotes: 0

Views: 37

Answers (1)

hspandher
hspandher

Reputation: 16733

You certainly can reset the head of the branch

git checkout dates
git reset --hard HEAD~1

But frankly, since the branch is just a human friendly name given to a commit id, why not just delete it and fork a new one.

git checkout master
git branch -D dates

Upvotes: 3

Related Questions