* Combining/merging commits
@ 2008-04-15 0:57 xpr1010
2008-04-15 6:37 ` Johannes Sixt
0 siblings, 1 reply; 3+ messages in thread
From: xpr1010 @ 2008-04-15 0:57 UTC (permalink / raw)
To: git
I have made several commits that should really have only been one, but
there was a lot of back and forth because of my inherent clumsiness.
Is there any way to combine or merge these commits to one?
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Combining/merging commits
2008-04-15 0:57 Combining/merging commits xpr1010
@ 2008-04-15 6:37 ` Johannes Sixt
2008-04-15 12:43 ` xpr1010
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2008-04-15 6:37 UTC (permalink / raw)
To: xpr1010; +Cc: git
xpr1010 schrieb:
> I have made several commits that should really have only been one, but
> there was a lot of back and forth because of my inherent clumsiness.
> Is there any way to combine or merge these commits to one?
Say, you have this commit series:
...--A--B--C--D
and you want to combine all of them, i.e. the last 4 commits, into a new
one, then you can do:
# undo commits, but leave working directory unchanged
$ git reset HEAD~4
# make a new commit
$ git commit
But if you want to combine only A,B,C because D should remain a separate
commit (i.e. what you want to combine are *not* the last commits), then
use git rebase --interactive, in particular, the 'squash' instruction. You
would use this todo list:
pick A
squash B
squash C
pick D
-- Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Combining/merging commits
2008-04-15 6:37 ` Johannes Sixt
@ 2008-04-15 12:43 ` xpr1010
0 siblings, 0 replies; 3+ messages in thread
From: xpr1010 @ 2008-04-15 12:43 UTC (permalink / raw)
To: git
Worked. Thanks! :)
On 15 Apr, 08:37, Johannes Sixt <j.s...@viscovery.net> wrote:
> xpr1010 schrieb:
>
> > I have made several commits that should really have only been one, but
> > there was a lot of back and forth because of my inherent clumsiness.
> > Is there any way to combine or merge these commits to one?
>
> Say, you have this commit series:
>
> ...--A--B--C--D
>
> and you want to combine all of them, i.e. the last 4 commits, into a new
> one, then you can do:
>
> # undo commits, but leave working directory unchanged
> $ git reset HEAD~4
> # make a new commit
> $ git commit
>
> But if you want to combine only A,B,C because D should remain a separate
> commit (i.e. what you want to combine are *not* the last commits), then
> use git rebase --interactive, in particular, the 'squash' instruction. You
> would use this todo list:
>
> pick A
> squash B
> squash C
> pick D
>
> -- Hannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-15 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 0:57 Combining/merging commits xpr1010
2008-04-15 6:37 ` Johannes Sixt
2008-04-15 12:43 ` xpr1010
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).