{"thread":{"id":"13114","subject":"Combining/merging commits","startedAt":"2008-04-15T00:57:30Z","lastAt":"2008-04-15T12:43:34Z","messageCount":3,"participants":["xpr1010","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"74397","messageId":"8e0b7b96-aee8-45a4-a160-023e92845434@n1g2000prb.googlegroups.com","threadId":"13114","inReplyTo":null,"subject":"Combining/merging commits","fromName":"xpr1010","fromEmail":"volition1980@gmail.com","sentAt":"2008-04-15T00:57:30Z","receivedAt":"2008-04-15T00:57:30Z","isPatch":false,"sender":{"key":"volition1980@gmail.com","avatar":null},"body":"I have made several commits that should really have only been one, but\nthere was a lot of back and forth because of my inherent clumsiness.\nIs there any way to combine or merge these commits to one?\n\nThanks!\n"},{"id":"74417","messageId":"48044D15.6040801@viscovery.net","threadId":"13114","inReplyTo":"8e0b7b96-aee8-45a4-a160-023e92845434@n1g2000prb.googlegroups.com","subject":"Re: Combining/merging commits","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-04-15T06:37:09Z","receivedAt":"2008-04-15T06:37:09Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"xpr1010 schrieb:\n> I have made several commits that should really have only been one, but\n> there was a lot of back and forth because of my inherent clumsiness.\n> Is there any way to combine or merge these commits to one?\n\nSay, you have this commit series:\n\n ...--A--B--C--D\n\nand you want to combine all of them, i.e. the last 4 commits, into a new\none, then you can do:\n\n    # undo commits, but leave working directory unchanged\n    $ git reset HEAD~4\n    # make a new commit\n    $ git commit\n\nBut if you want to combine only A,B,C because D should remain a separate\ncommit (i.e. what you want to combine are *not* the last commits), then\nuse git rebase --interactive, in particular, the 'squash' instruction. You\nwould use this todo list:\n\n    pick A\n    squash B\n    squash C\n    pick D\n\n-- Hannes\n"},{"id":"74442","messageId":"6e6761f0-7457-4674-a935-92d00c294b21@b9g2000prh.googlegroups.com","threadId":"13114","inReplyTo":"48044D15.6040801@viscovery.net","subject":"Re: Combining/merging commits","fromName":"xpr1010","fromEmail":"volition1980@gmail.com","sentAt":"2008-04-15T12:43:34Z","receivedAt":"2008-04-15T12:43:34Z","isPatch":false,"sender":{"key":"volition1980@gmail.com","avatar":null},"body":"Worked. Thanks! :)\n\nOn 15 Apr, 08:37, Johannes Sixt <j.s...@viscovery.net> wrote:\n> xpr1010 schrieb:\n>\n> > I have made several commits that should really have only been one, but\n> > there was a lot of back and forth because of my inherent clumsiness.\n> > Is there any way to combine or merge these commits to one?\n>\n> Say, you have this commit series:\n>\n>  ...--A--B--C--D\n>\n> and you want to combine all of them, i.e. the last 4 commits, into a new\n> one, then you can do:\n>\n>     # undo commits, but leave working directory unchanged\n>     $ git reset HEAD~4\n>     # make a new commit\n>     $ git commit\n>\n> But if you want to combine only A,B,C because D should remain a separate\n> commit (i.e. what you want to combine are *not* the last commits), then\n> use git rebase --interactive, in particular, the 'squash' instruction. You\n> would use this todo list:\n>\n>     pick A\n>     squash B\n>     squash C\n>     pick D\n>\n> -- Hannes\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majord...@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}