I followed the instructions from this stack overflow question to perform an interactive rebase but the interactive rebase session doesn't pull up all 8 of my previous commits (the history of the repo only has 8 commits).
This is my current commit history:
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$ git log --oneline
80b0645 (HEAD -> master, origin/master) Applied Bill's changes. Resolve merge conflict.
cdfcbf1 Modified line 1.
073e94b Modified line in newmodule.py
d39ae96 Added newmodule.py
118a892 deleted newmodule.txt
81c7945 Changed newmodule.txt added Hello World!
add5483 Minh added newmodule.txt
386249b First commit.
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$ git rebase -i HEAD~~8
fatal: invalid upstream 'HEAD~~8'
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$ git rebase -i HEAD~~7
fatal: invalid upstream 'HEAD~~7'
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$ git rebase -i HEAD~~6
fatal: invalid upstream 'HEAD~~6'
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$ git rebase -i HEAD~~5
It works for HEAD~5
and this is all I see in the interactive session.
pick add5483 Minh added newmodule.txt
pick 81c7945 Changed newmodule.txt added Hello World!
pick 118a892 deleted newmodule.txt
pick d39ae96 Added newmodule.py
pick cdfcbf1 Modified line 1.
pick 073e94b Modified line in newmodule.py
# Rebase 386249b..80b0645 onto d39ae96 (6 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# ...
I want to revert the state of my repository to what it was like immediately after the first commit (386249b
) but as you can see, I don't see my most recent commit (80b0645
). I tried dropping
the commits:
d add5483 Minh added newmodule.txt
d 81c7945 Changed newmodule.txt added Hello World!
d 118a892 deleted newmodule.txt
d d39ae96 Added newmodule.py
d cdfcbf1 Modified line 1.
d 073e94b Modified line in newmodule.py
Which seems to have done the job (after rebasing my commit history looks like this):
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$ git log --oneline
386249b (HEAD -> master) First commit.
mtran@whg355 MINGW64 ~/Desktop/20-0082-00/src (master)
$
So I wonder:
- Why commit
80b0645
wasn't included in the count? - Why/if rebasing is suppose to show my very first commit (
386249b
)? - Why
git rebase -i HEAD~5
worked (and what5
refers to)?
Per suggestions to run git log --all --decorate --oneline --graph
:
$ git log --all --decorate --oneline --graph
* 80b0645 (HEAD -> master, origin/master, origin/HEAD) Applied Bill's changes. Resolve merge conflict.
|\
| * 073e94b Modified line in newmodule.py
* | cdfcbf1 Modified line 1.
|/
* d39ae96 Added newmodule.py
* 118a892 deleted newmodule.txt
* 81c7945 Changed newmodule.txt added Hello World!
* add5483 Minh added newmodule.txt
* 386249b First commit.