Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unsquash a commit?

Tags:

I have squashed 40 commmits at some point in time, and would like to pick back one commit. Is there some way to do this? I have the commit ref (93ebc467ff512580ae3c5a76790f09dfd5e3e6f2) that I would like to unsquash.

like image 692
cmouse Avatar asked Jun 05 '13 04:06

cmouse


People also ask

How do I squash a specific commit?

Git squash with a commit id You must type the word pick next to the commit you want all others to be squashed into. Then type 'squash', or just the letter 's', next to each commit to squash.


2 Answers

You can add the patch representing that commit onto the top of the branch you are on by doing

git cherry-pick 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2
like image 187
Johan Lundberg Avatar answered Sep 19 '22 05:09

Johan Lundberg


You could use git reflog to browse all the commits that existed! Or since you have the commit hash you could just do a git checkout 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2 and see the commit itself..

like image 43
Gaurav Agarwal Avatar answered Sep 19 '22 05:09

Gaurav Agarwal