Rodrigo
Rodrigo

Reputation: 12683

How delete all pushable commits?

I try to use the git filter-branch to remove some big files. This was not a good idea because it rewrite the history and create a new branch doubling all commits.

Now I want to redo this. I see in SmartGit (a git graphic interface) that it create a lot of pushable commits. How can I delete it and undo all this commits?

I will have to delete one by one using the SHA ID?

Upvotes: 1

Views: 451

Answers (2)

knittl
knittl

Reputation: 265131

git filter-branch will create a backup copy of your unwritten refs inside the .git/refs/original/ directory. You might get lucky by moving those refs to their previous location (.git/refs/heads/) – be sure to make a backup copy of your complte repository first ;)

That way you don't have to reset each branch head separately.

Upvotes: 0

Igor Popov
Igor Popov

Reputation: 10093

If you didn't yet push them you can do a git reset --hard HEAD~X where X is the number of commits.

Upvotes: 3

Related Questions