我正在尝试将位于 HEAD 的提交压缩为后面的提交。当我跑步时git rebase -i HEAD~7
,但是,我只看到一个noop
在编辑器中!我完全不知道这是如何运作的。
我在分行工作(cleanup
)我创建的(使用checkout -b cleanup ...
在我发现的 SHA1 上reflog
)在我有了第一次之后rebase
经验和我不小心删除了所有这些提交;重点是,我不确定分支的父级是什么(如果这很重要,请在这里)。
我只是想做我已经读过很多次的事情:我想稍微修改一些不是最新提交的已提交代码。我不知道这是“压制”应用程序还是只是在达到这一点时对其进行修改。
当编辑器在运行上面所示的 rebase 命令后启动时,我也在 STDOUT 上看到了这一点:
$ git rebase -i HEAD~7
usage: git rev-list [OPTION] <commit-id>... [ -- paths... ]
limiting output:
--max-count=<n>
...
除了HEAD~7
参考,我尝试指定整个 SHA1,以及本地和远程分支的不同引用规范。一切都相同的结果...
我缺少什么?感谢您的帮助!
Edit:
$ git log --oneline HEAD~7..HEAD
d0fd20e temp Fix resume_cities table
ea2ffdf Fix db/seeds.rb to reflect recent database structure modifications
dbd2b8b Add several models/scaffolds that go along with the Geonames tables
9759091 Fix name of the ResumeSkill model file.
3fc3134 Added the SHA1 for the previous commit to the comments on the migration, to help link back to that.
bacbeb2 Consolidate database migrations! READ ME!
0c49a57 Moved back to gem versions of linkedin, omniauth, and twitter
这是bacbeb2
提交我想修改d0fd20e
根据@MarkLongair的建议,我添加了set -x
to /usr/lib/git-core/git-rebase--interactive
并看到以下奇怪的输出:
$ git rebase -i HEAD~7
[... output muted for brevity, see the full output, here: http://gist.github.com/1163118]
+ read -r shortsha1 rest
+ sed -n s/^>//p
+ git rev-list --no-merges --cherry-pick --pretty=oneline --abbrev-commit --abbrev=7 --reverse --left-right --topo-order 2c51946812a198ca908ebcad2308e4b8274624b3...d0e9ff6d9c1f8bc374856ca2a84ad52d6013b5bf
usage: git rev-list [OPTION] <commit-id>... [ -- paths... ]
limiting output:
--max-count=<n>
--max-age=<epoch>
--min-age=<epoch>
--sparse
--no-merges
--remove-empty
--all
--branches
--tags
--remotes
--stdin
--quiet
ordering output:
--topo-order
--date-order
--reverse
formatting output:
--parents
--children
--objects | --objects-edge
--unpacked
--header | --pretty
--abbrev=<n> | --no-abbrev
--abbrev-commit
--left-right
special purpose:
--bisect
--bisect-vars
--bisect-all
+ test t =
+ test -s /home/ryan/Projects/social-jobs/.git/rebase-merge/git-rebase-todo
+ echo noop
[...]
我说“奇怪的输出”,因为如果我运行rev-list
直接从我的 shell 命令,它按预期工作:
$ git rev-list --no-merges --cherry-pick --pretty=oneline --abbrev-commit --abbrev=7 --reverse --left-right --topo-order 2c51946812a198ca908ebcad2308e4b8274624b3...d0e9ff6d9c1f8bc374856ca2a84ad52d6013b5bf
>0c49a57 Moved back to gem versions of linkedin, omniauth, and twitter
>bacbeb2 Consolidate database migrations! READ ME!
>3fc3134 Added the SHA1 for the previous commit to the comments on the migration, to help link back to that.
>9759091 Fix name of the ResumeSkill model file.
>dbd2b8b Add several models/scaffolds that go along with the Geonames tables
>ea2ffdf Fix db/seeds.rb to reflect recent database structure modifications
>d0e9ff6 !temp Fix resume_cities table !temp