I have a branch with about 20 commits.
The first SHA on the branch is bc3c488...
The last SHA on the branch is 2c2be6...
How can I
The first SHA on the branch is bc3c488...
The last SHA on the branch is 2c2be6...
# non dangerous implementation that creates a new branch.
git checkout 2c2be6
git rebase -i bc3c488~
git checkout -b your_new_squashed_branch
# then squash the commits by replacing the pick with s
The tilda (~) at the end of the commit means previous commit;
Ensuring commit bc3c488 is visible on the interactive rebase.
# dangerous implementation that rewrites history
git checkout -b new_branch_with_rewritten_history
git reset --hard 2c2be6
git rebase -i bc3c488~
# then squash the commits by replacing the pick with s