I did an interactive rebase with more commits than I needed to change. I was surprised that the shas of the unnessisary changes were updated. Unfortunately I only realised this happened after I force pushed my updates.
What I did
Starting point
X - Y \
A - B - C *master (C is a merge commit)
\
- D - E *feature-branch
- ran
git rebase -i head~3 - squashed
DandE(we'll call thisD1) - changed the commit message of the new
D1commit - Left
A,B, andCaspickand didn't make any changes
My expectation was that everything would look like this:
X - Y \
A - B - C *master
\
- D1 *feature-branch
- force pushed my branch
When I went to my PR, things actually looked like this:
X - Y \
A - B - C *master
\
- A1 - B1 - C1 - D1 *feature-branch
Where A1, B1, and C1 had the same commit messages and changes as A, B, and C, but with different shas.
Questions
- How can I remove
A1,B1, andC1from my PR without impacting master'sA,B, andC? - What's going on with
rebase -i? Why did includingA,B, andCin my rebase command make any changes since I just left them aspick?