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 https://gist.github.com/akshatpradhan/826c2f161b532c81e034

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
Tags
git

Crowdsource coding tasks.

1 Solution

Winning solution

You'll want to perform an interactive rebase... there is a good explanation of that here: https://help.github.com/articles/interactive-rebase

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: https://github.com/akshatpradhan/spoutlets/compare/therapist_login Perhaps it makes more sense to edit the first commit and discard the "remove scaffolds css" commit? Instead of Squash? What do you think? https://help.github.com/articles/interactive-rebase#edit
akshatpradhan 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 6 years ago