0

I want to merge e5c1e1d and 627c6c6

How to do it ? I want an easier way.

Because if there are hundreds commits between them, it will be very trouble to do rollback then re-commit.

screenshot

* fc60bec - (HEAD, master) Make db migrate (67 seconds ago)
* e5c1e1d - Add application page ,css , javascript (78 seconds ago)
* b6c5b68 - Add sandbox page (3 minutes ago)
* 7552b76 - Add welcome controller (25 minutes ago)
* 627c6c6 - Add themes folder into projects (54 minutes ago)
* 856c719 - Initial commit (68 minutes ago)

When I ran git rebase --interactive 856c719

Then I edited the file in the following, after saving it.

I got

2_dqa_streesful_server/.git/rebase-merge/stopped-sha: No such file or directory Cannot 'squash' without a previous commit

  1 squash 627c6c6 Add themes folder into projects
  2 pick 7552b76 Add welcome controller
  3 pick b6c5b68 Add sandbox page
  4 squash e5c1e1d Add application page ,css , javascript
  5 pick fc60bec Make db migrate
newBike
  • 14,385
  • 29
  • 109
  • 192

1 Answers1

0

git rebase --interactive 856c719

And then replace pick with squash for the commits you want to squash (merge):

pick   856c719 Initial commit
squash 627c6c6 Add themes folder into projects
pick   7552b76 Add welcome controller
pick   b6c5b68 Add sandbox page
squash e5c1e1d Add application page ,css , javascript
pick   fc60bec Make db migrate
quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
Oleksandr Kravchuk
  • 5,963
  • 1
  • 20
  • 31
  • I got this error `Cannot 'squash' without a previous commit` – newBike Apr 17 '14 at 10:12
  • Oleksandr, please review my edit. Your original example was completely trashed. Either something damaged it, or you wrote it waaay to fast and made a lot of errors. I tried to salvage as much as I could, but you should double-check it after me. (btw. I also reversd the order to make it more like actual git-rebase-i, please check it too.) – quetzalcoatl Apr 17 '14 at 10:17
  • By the way, **squash** will incorporate the squashed commit into the one that directly precedes it. It is probably not what author wants. Author seems to want to squash the e5c1e1d and 627c6c6 **together** not into b6c5b68 and 856c719 respectively – quetzalcoatl Apr 17 '14 at 10:19
  • @poc: it's because your rebase is missing the "pick 856c719 Initial commit" as the first line. However, please don't try it until you are sure you really want to squash them like that. Please read my previous comment to Oleksandr ("By the way.."). – quetzalcoatl Apr 17 '14 at 10:21
  • @poc try `git rebase --root -i` instead. – Oleksandr Kravchuk Apr 17 '14 at 10:27