Question:
I initialized a new git in my project and I have only two commits so far. My log is like below
1 2 3 4 5 6 7 8 9 10 11 12 13 |
git log commit e515e5b8dcbd8f1ea4a7a7d4a1efb82a1a0aee7a Author: Olkun Mustafa Date: Fri Oct 3 10:04:20 2014 +0300 Temp commit commit 71781bf0a7807351a56d5155dac94169ea700527 Author: Olkun Mustafa Date: Fri Oct 3 10:01:42 2014 +0300 First Commit |
When I try to rebase this commits I get error like below
1 2 3 4 |
git rebase --interactive HEAD~2 fatal: Needed a single revision invalid upstream HEAD~2 |
I quite research at google but I haven’t found solution till now.
Answer:
In your case, there is no HEAD~2
, since you only have 2 commits, hence the “Needed a single revision
” error message.
Try:
1 2 |
git rebase -i --root |
see more about --root
at “Change first commit of project with Git?”