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