A common development workflow for us is to checkout branch b
, commit a bunch to it, then squash all those commits into one (still on b
).
However, during the rebase -i
process to squash all the commits, there are frequently conflicts at multiple steps.
I essentially want to alter the branch into one commit that represents the state of the repository at the time of the final commit on b
I've done some searching but I haven't found exactly what I'm looking for. I don't want to merge --squash
because we would like to test the squashed feature branch before merging.
If you don't need the commit information, then you could just do a soft reset. Then files remain as they were and when you commit, this commit will be on top of the commit you did reset to.
To find the commit to reset to:
git merge-base HEAD BRANCH_YOU_BRANCHED_FROM
Then
git reset --soft COMMIT_HASH
Then re-craft the commit, perhaps:
git commit -am 'This is the new re-created one commit'