Git squash/merge question regarding a commit
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

So I have this commit

I want to "Squash" or merge the top commit regarding deleting of scaffolds css with the other commit that actually has the scaffolds.css.less file.

How do I squash the commits so that the top commit of deleting scaffolds css goes away and the scaffolds.css.less file is removed from the "add therapist scaffold" commit?

awarded to slang

Crowdsource coding tasks.

1 Solution

Winning solution

You'll want to perform an interactive rebase... there is a good explanation of that here:

Can you walk through the exact commands for this? I learn better with an example and I'm fearful of doing anything because last time I tried this, I lost all my work, and I never wanted to touch git rebase after that The relevant commits are b52c370 and 5b94cfa from this branch: Perhaps it makes more sense to edit the first commit and discard the "remove scaffolds css" commit? Instead of Squash? What do you think?
akshatpradhan over 6 years ago
If you're worried about screwing something up, you can clone your git repo into a new folder, and just rm it and not push anything if it gets messed up. As for the actual commands: git rebase --interactive HEAD~7 then I think you just reorder the commits so that the 2 relevant commits are next to each other, and squash the 2 together
slang over 6 years ago