Re: how to combine 2 commits?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2009-01-13, bill lam <cbill.lam@xxxxxxxxx> wrote:
> Sorry I don't know the correct git terminology for it.  I make some
> changes to scripts but also accidentally changed all scripts to use
> dos linefeed.  Failed to notice this and commit all changes. Then I
> tried to correct it by changing all scripts back to unix
> linefeed and commit again.
>
> How to combine these 2 commits so that the changes of linefeed cancel
> out each other and the history only shows the intended changes of the
> few scripts.

I tend to make lots of small commits on the work tree, and
having to combine them meaningfully later.

I like using "git rebase -i HEAD~5" (if I want to rebase the
last 5 commits).  In the editor that pops up, I reorder the
ones that I know should be together, and on each set to be
squashed, I change the "pick" to "s" (for squash) on all but
the first one.  Save the file and it's all done.

Works like a charm.  For me, moving commits around in an
editor, deleting them even, is very intuitive.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux