I goofed the author info. up on the first commit.
However, it seems like most of the rebase or tree modification operations rely on some other commit already existing.
Even when I run Git's interactive rebase command, all I see in my little list of commits is a single line, "noop". :/ (Solved this by running my rebase against the Git tree's root
with git rebase -i --root
, but removing the line for the first commit I made did not actually remove it from the tree.)
Rebasing on top of root
, or the first commit, does not work.
[vagrant@localhost vagrant]$ git rebase -i HEAD~1
fatal: Needed a single revision
invalid upstream HEAD~1
[vagrant@localhost vagrant]$ git rebase -i HEAD
Unknown command: rnoop
Please fix this using 'git rebase --edit-todo'.
[vagrant@localhost vagrant]$ git rebase --edit-todo
[vagrant@localhost vagrant]$ git rebase --abort
The following looked like a relevant possible alternative answer, but I think something more, or at least more specific, is worth an answer for this special case:
Delete commits from a branch in Git
This other answer (How do you undo the last commit?) resulted in the following:
[vagrant@localhost vagrant]$ git reset --soft HEAD~
fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
[vagrant@localhost vagrant]$ git reset --soft HEAD
Here, for those still reading this, is the vim buffer with noop
I mentioned earlier:
noop
# Rebase 3d1c632..3d1c632 onto 3d1c632 (1 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
For those wondering why I don't just edit the files and re-add them to the commit, or something, I had incorrect author information, which I corrected only after I had run "git commit", and I changed the author information while I had the commit message open for editing.
Maybe I could try deleting the entire .git
folder, or something, but I'd prefer a more elegant way.
Plus, if I don't delete the entire .git
folder, I keep my hooks and stuff, and I have a feeling that answers to this sort of question will speak to fundamental design principles in Git that I may not yet understand.