I am trying to crush a commit that is in HEAD into one that is a bit backward. However, when I run git rebase -i HEAD~7 , only noop forwards me to the editor! I am completely confused about how this should work.
I work in the ( cleanup ) branch that I created (using checkout -b cleanup ... in SHA1, which I found in reflog ) after I had my first rebase experience and accidentally deleted all these commits; I'm not sure what a parent branch is (if that matters, here).
I am just trying to do what I read many times: I want to modify some code a bit, which is not the last. Regardless of whether the crush application or just corrects it when I get to this point, I don't know.
I also see this in STDOUT when the editor starts after running the rebase command shown above:
$ git rebase -i HEAD~7 usage: git rev-list [OPTION] <commit-id>... [ -- paths... ] limiting output: --max-count=<n> ...
In addition to the HEAD~7 link, I tried to specify all SHA1 and various refspecs for local and remote branches. The same result for everything ...
What am I missing? Thank you for your help!
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
This is the bacbeb2 command that I want to change with d0fd20e
Following @MarkLongair’s recommendation, I added set -x to /usr/lib/git-core/git-rebase--interactive and saw the following weird output:
$ git rebase -i HEAD~7 [... output muted for brevity, see the full output, here: http://gist.github.com/1163118] + read -r shortsha1 rest + sed -ns/^>//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 [...]
I say "strange output" because if I run the rev-list command directly from my shell, it works as expected:
$ 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