我想更改第一条提交消息
$ git log --oneline
dfdbdf9 (HEAD -> master) databse changed and user post route created
aa29809 user model created
d8216e4 initial express server with route fies
如何使用d8216e4 commit hast(非常第一)更改提交消息。
我尝试过
git rebase -i HEAD~3
但是它显示了这样的内容
fatal: Needed a single revision
invalid upstream 'HEAD~3'
此外,在使用HEAD〜1或HEAD〜2时,除第一个消息外的所有git消息都是ediatbale
答案 0 :(得分:0)
您的存储库只有三个提交:HEAD
,HEAD~1
和HEAD~2
。没有提交HEAD~3
,因此出错。
您需要运行git rebase -i --root
。
答案 1 :(得分:0)
使用git rebase --root -i
。从手册中:
--root
Rebase all commits reachable from <branch>, instead of limiting
them with an <upstream>. This allows you to rebase the root
commit(s) on a branch. When used with --onto, it will skip changes
already contained in <newbase> (instead of <upstream>) whereas
without --onto it will operate on every change. When used together
with both --onto and --preserve-merges, all root commits will be
rewritten to have <newbase> as parent instead.