Cannot get how to perform squash rebase for the current branch. The console command would be
git rebase -i HEAD~2
and then squash as usually. But how to do the same in TGit?
Script to initialize the case
git init . touch 1 git add 1 git commit -m "1" touch 2 git add 2 git commit -m "2" touch 3 git add 3 git commit -m "3"
As a result after squashing we would have 1 commit with 3 files.
Any proposals?
Right-Click in the File explorer within the repository and select TortoiseGit =>Create Branch. Name it enhancement and select the checkbox Switch to the new branch. Click Ok. Make a change to the file in the enhancement branch and commit the same.
Squash commits together. Two other commands rebase interactive offers us are: squash ( s for short), which melds the commit into the previous one (the one in the line before) fixup ( f for short), which acts like “squash”, but discards this commit's message.
Merge squash merges a tree (a sequence of commits) into a single commit. That is, it squashes all changes made in n commits into a single commit. Rebasing is re-basing, that is, choosing a new base (parent commit) for a tree.
This works for me using TortoiseGit 1.7.12:
TortoiseGit
-> Show log
from the context menu.Rebase master onto this...
from the context menu.Force Rebase
checkbox and then right-click on the commit to choose between Pick
, Squash
, etc., or tick the Squash ALL
checkbox in your case.Start Rebase
button, which on success turns into a Commit
button, and then into a Done
button. Press all of them.Note that in your example script you would squash / fixup to the root commit, which is a special case and does not work as described above because the root commit has no parent that you could select in step 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With