What I have:
---A----B-----C-----D--------*-----E-------> (master)
\ /
1----2 (foo)
What I need:
---A---------------D--------*-----E-------> (master)
\ /
1----2 (foo)
A while ago I made two commits I would like to remove from my git repo. I tried a variety of different rebasing "tutorials" and all of them ended in weird git histories, so I created an example repo, and the result is not what I expected. Can anyone help me to understand what I am missing?
I have two branches, master
and foo
. I made a commit B with a single file I would like to remove, and commit C where I modified this file. Along the other commits, I never touched this file ever again.
Commit IDs:
A: f0e0796
B: 5ccb371
C: a46df1c
D: 8eb025b
E: b763a46
1: f5b0116
2: 175e01f
So I use rebase -i f0e0796
and remove B 5ccb371
and and C a46df1c
, correct? If I interpret the result correctly, this is what gitk
shows me for my repo, although git branches
still lists the second branch.
---A-----1----2---E------> (master)
Can anyone tell me what happened here?
Edit: This is how to recreate the repo from the first graph:
git init foo
cd foo
touch A
git add A
git commit -m "add A"
touch B
git add B
git commit -m "add B"
echo "modify" > B
git add B
git commit -m "modify B"
touch C
git add C
git commit -m "add C"
git checkout -b foo
touch 1
git add 1
git commit -m "add 1"
touch 2
git add 2
git commit -m "add 2"
git switch master
git merge foo --no-ff
touch E
git add E
git commit -m "add E"