If the 100 initial commits are still on master : you can use git replace
in your repo to, locally, have a view where the 100 commits are part of your staging
branch :
git replace <squash commit id> <original commit id>
# to list existing replacements in your local repo :
git replace -l
# to delete a replacement :
git replace -d <object id> # <- <squash commit id> in your case
Check git help replace
for more details.
emphasize on the locally :
the swapping of commits will not be shared with the central repo, nor with other users.
On your local clone, git will view the commit graph differently, and some commands will not have the same result as on other machines.
For example : with the above replacement active, if from your staging
branch you run git merge master
:
- your local repo will consider that the 100 commits from master are already merged,
- any other clone will try to re-merge the 100 commits, and trigger different merge conflicts.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…