I got couple commits on Gitlab inside my branch and want to squash them in one BEFORE merge(!important). When I try git rebase -i
the terminal responds with error: nothing to do
. How can I make it work?
You could get it done with a one-liner setup as an alias to not have to do anything:
git reset --soft $( git merge-base @{u} HEAD ); git commit
This should open the terminal window so you can provide the text for the commit.... turn that into a script and then you could get it to handle the comment (by capturing additional parameters) in a single shot and so on.
Adding a check to make sure that the working tree is clean before running that would be a nice addition.