Home > Software design >  Show all commits in repository with git rebase
Show all commits in repository with git rebase

Time:02-15

I am running git rebase HEAD~X and I can't take all of the commits on the text editor which opens after I run this command, I have 6 commits that appears when I run git log --all.

Running git rebase -i HEAD~2 it shows to me only 2 to edit, I'm not allowed to run not even HEAD~3, Doing so I get

fatal: invalid upstream 'HEAD~6'

I think this is happening because I ran git reset before, I want to see all of the 6 commits on git rebase.

Edit

I have one repository which contains only one branch called "main" and 6 commits since the beginning: https://github.com/DevEsteves/WebScrapingWithPython

CodePudding user response:

I want to see all of the 6 commits on git rebase

All you can see in an interactive rebase todo list is the parent chain starting at where you are now (HEAD). If some of those 6 commits are not your direct parent / ancestor, you will not see them in the list.

I have 6 commits that appears when I run git log --all

But that doesn't mean there are 6 ancestor commits between you and the start. Try

git log --all --oneline --decorate --graph

for a better look at where you are.

That said, note that you can likely get one more commit into your interactive rebase todo list by saying

git rebase -i --root
  • Related