1

I have a tree like the below in my git log. I want to take those first 10 commits and squash them into one. So I ran git rebase -i HEAD~10

That's a pain to count out and see that's 10 entries though. Is there a way to specify the target commit by the SHA instead? Like git rebase -i 79a1363?

* 8e43e2d (HEAD -> share) fastlane changes
* a09c655 Handles landscape for iPhone now
* 2c764e1 Now deletes ALL tickets of a type, instead of just a specific date range. Added fast lane support for beta deployment.
* 6f6c577 Updated version for push
* c422d06 Fixed for iPad
* 948bcd4 Fixed master view cells.
* b82df83 Fixed the loser detail view cell
* c31d8b5 Winnings now properly displays at all text sizes.
* ff15e79 Wrote the winning/losing cells.
* 79a1363 Bunch of stuff for larger text
* e58b1f9 (tag: v6.2.3, origin/master, origin/HEAD, master) 6.2.3
* 3f02a27 (tag: v6.2.1) Version 6.2.1
* 7703d55 (tag: v6.2.0) Updated revision
Gargoyle
  • 9,590
  • 16
  • 80
  • 145
  • If you want to squash all your commits, it's better to just use [`merge --squash`](https://stackoverflow.com/questions/5308816/how-to-use-git-merge-squash) instead. – Samir Aguiar Nov 08 '17 at 22:18
  • 3
    Does "git rebase -i 79a1363" not work for you? It does for me. Mind you, if you want to squash that commit too, you need to go back one more with "git rebase -i e58b1f9". – joanis Nov 08 '17 at 22:21
  • See https://stackoverflow.com/a/5201642/641955 – janos Nov 08 '17 at 22:21
  • Thanks. The "go one more" was my mistake. – Gargoyle Nov 08 '17 at 22:22
  • Unrelated thought: if you are counting commits most probably you are doing something inefficient or your branches are not very well organised. Usually in most scenarios you should just use other refs, human-readable names. In your scenario more sensible is to use `git rebase -i master`. – kan Nov 09 '17 at 00:06
  • The branch had ten commits related to the one feature. – Gargoyle Nov 09 '17 at 00:06

0 Answers0