git squash commit together

This is the best way to squash N number of commits togeether. The only thing is, you need to do a force "git push" Let's say you need to squash 10 previous commits together, then you need run the following command:- 

git reset --soft HEAD~3
git commit -m "Squashed commit"

And MUST be follow by 

git push --force-with-lease origin <branch-name>

Otherwise you're going to get a messy branch.


Comments

Popular posts from this blog

vllm : Failed to infer device type

android studio kotlin source is null error

gemini cli getting file not defined error