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

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type