Squashing a branch into one commit

Assuming you’re currently on the feature branch:

git checkout -b temp main
git merge --squash feature
git commit
git checkout feature
git reset --hard temp
git branch -d temp

Source: StackOverflow

 
Respond to this post via e-mail