git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* how to combine 2 commits?
@ 2009-01-13  4:54 bill lam
  2009-01-13  5:08 ` Jeff Whiteside
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: bill lam @ 2009-01-13  4:54 UTC (permalink / raw
  To: git

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.

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩234 李白  怨情
    美人捲珠簾  深坐蹙蛾眉  但見淚痕濕  不知心恨誰

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  4:54 how to combine 2 commits? bill lam
@ 2009-01-13  5:08 ` Jeff Whiteside
  2009-01-13  5:27 ` Boyd Stephen Smith Jr.
  2009-01-13  6:35 ` Sitaram Chamarty
  2 siblings, 0 replies; 9+ messages in thread
From: Jeff Whiteside @ 2009-01-13  5:08 UTC (permalink / raw
  To: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB2312, Size: 992 bytes --]

git terminology is "squash"

On Mon, Jan 12, 2009 at 11:54 PM, bill lam <cbill.lam@gmail.com> 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.
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> ÌÆÔŠ234 Àî°×  Ô¹Çé
>    ÃÀÈË’ÔÖ麟  Éî×øõ¾¶êü  µ«ÒŠœIºÛñ  ²»ÖªÐĺÞÕl
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  4:54 how to combine 2 commits? bill lam
  2009-01-13  5:08 ` Jeff Whiteside
@ 2009-01-13  5:27 ` Boyd Stephen Smith Jr.
  2009-01-13  5:32   ` Imran M Yousuf
  2009-01-13  7:51   ` bill lam
  2009-01-13  6:35 ` Sitaram Chamarty
  2 siblings, 2 replies; 9+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-01-13  5:27 UTC (permalink / raw
  To: git; +Cc: bill lam

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

On Monday 12 January 2009, bill lam <cbill.lam@gmail.com> wrote about 'how 
to combine 2 commits?':
>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.

Two ways I can think of:
git rebase --interactive (read "git help rebase" first)
git merge --squash (read "git help merge" first)

The rebase is probably semantically closer to how you are thinking about 
things right now.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  5:27 ` Boyd Stephen Smith Jr.
@ 2009-01-13  5:32   ` Imran M Yousuf
  2009-01-13  7:51   ` bill lam
  1 sibling, 0 replies; 9+ messages in thread
From: Imran M Yousuf @ 2009-01-13  5:32 UTC (permalink / raw
  To: Boyd Stephen Smith Jr.; +Cc: git, bill lam

On Tue, Jan 13, 2009 at 11:27 AM, Boyd Stephen Smith Jr.
<bss@iguanasuicide.net> wrote:
> On Monday 12 January 2009, bill lam <cbill.lam@gmail.com> wrote about 'how
> to combine 2 commits?':
>>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.
>
> Two ways I can think of:
> git rebase --interactive (read "git help rebase" first)
> git merge --squash (read "git help merge" first)
>
> The rebase is probably semantically closer to how you are thinking about
> things right now.

Another way I can think of is - git format-patch + git apply, i.e.
first generate 2 patches for the 2 commits and then apply them one on
top of another.

Best regards,

Imran

> --
> Boyd Stephen Smith Jr.                     ,= ,-_-. =.
> bss@iguanasuicide.net                     ((_/)o o(\_))
> ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-'
> http://iguanasuicide.net/                      \_/
>



-- 
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: imran@smartitengineering.com
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  4:54 how to combine 2 commits? bill lam
  2009-01-13  5:08 ` Jeff Whiteside
  2009-01-13  5:27 ` Boyd Stephen Smith Jr.
@ 2009-01-13  6:35 ` Sitaram Chamarty
  2009-01-13  6:48   ` Matthieu Moy
  2 siblings, 1 reply; 9+ messages in thread
From: Sitaram Chamarty @ 2009-01-13  6:35 UTC (permalink / raw
  To: git

On 2009-01-13, bill lam <cbill.lam@gmail.com> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  6:35 ` Sitaram Chamarty
@ 2009-01-13  6:48   ` Matthieu Moy
  2009-01-13 11:32     ` Sitaram Chamarty
  0 siblings, 1 reply; 9+ messages in thread
From: Matthieu Moy @ 2009-01-13  6:48 UTC (permalink / raw
  To: Sitaram Chamarty; +Cc: git

Sitaram Chamarty <sitaramc@gmail.com> writes:

> 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.

And right after, you probably want to do stg like

  git diff master@{1} master

to see whether you actually changed the result by reordering your
patches.

-- 
Matthieu

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  5:27 ` Boyd Stephen Smith Jr.
  2009-01-13  5:32   ` Imran M Yousuf
@ 2009-01-13  7:51   ` bill lam
  2009-01-13 11:20     ` Stephen R. van den Berg
  1 sibling, 1 reply; 9+ messages in thread
From: bill lam @ 2009-01-13  7:51 UTC (permalink / raw
  To: git

On Mon, 12 Jan 2009, Boyd Stephen Smith Jr. wrote:
> git rebase --interactive (read "git help rebase" first)

I tried rebase the last 3 commit, but it failed.

bill@b2j:jproject$ git log --pretty=oneline | head
39ed365c11391bede0e1b6578adfac6619b78c0a for yajpp to use unix LF
70c812db2439bc84a8dd7ea831067b9ebf29885c revert last crlf error
f338a768d635b868e6fddaae670ad91d46ea7c4e format scripts   

bill@b2j:jproject$ git rebase -i HEAD~3
error: Entry 'trunk/jcalc/mmenu-mm.ijs' not uptodate. Cannot merge.
fatal: merging of trees a1eafe6cdbb428f851d6ca878bbc53149fb7e7eb and
a00e6dcd3ec3f4ffde0d1aad1958db724093de69 failed

Could not apply 70c812d... revert last crlf error

It looks like cannot resolve conflict of linefeed changes. It was
expected all scripts will conflict, so I have to abort the rebase.

What is the procedure to generate a patch of the HEAD from HEAD~4,
then cancel all changes from HEAD~3 up to HEAD, and then apply the
patch to the previous HEAD~4 ?

BTW, what is the norm of reply in this list, should it be reply to
list only, or reply to group (list plus all cc)?

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩213 李商隱  無題二首之二
    颯颯東風細雨來  芙蓉塘外有輕雷  金蟾齧璅燒香入  玉虎牽絲汲井迴
    賈氏窺簾韓掾少  宓妃留枕魏王才  春心莫共花爭發  一寸想思一寸灰

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  7:51   ` bill lam
@ 2009-01-13 11:20     ` Stephen R. van den Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen R. van den Berg @ 2009-01-13 11:20 UTC (permalink / raw
  To: git

bill lam wrote:
>BTW, what is the norm of reply in this list, should it be reply to
>list only, or reply to group (list plus all cc)?

This list prefers list plus all cc.
-- 
Sincerely,
           Stephen R. van den Berg.

"I have a *cunning* plan!"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to combine 2 commits?
  2009-01-13  6:48   ` Matthieu Moy
@ 2009-01-13 11:32     ` Sitaram Chamarty
  0 siblings, 0 replies; 9+ messages in thread
From: Sitaram Chamarty @ 2009-01-13 11:32 UTC (permalink / raw
  To: git

On 2009-01-13, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
> Sitaram Chamarty <sitaramc@gmail.com> writes:
>
>> 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.
>
> And right after, you probably want to do stg like
>
>   git diff master@{1} master
>
> to see whether you actually changed the result by reordering your
> patches.

I used to do that, but now I've stopped.  If it doesn't
conflict, I know it's good.  I go straight to the equivalent
of make && make test.

I must mention though, that I don't reorder the relative
sequences of commits affecting the same file/set of files.
That might have something to do with my confidence :-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-01-13 11:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13  4:54 how to combine 2 commits? bill lam
2009-01-13  5:08 ` Jeff Whiteside
2009-01-13  5:27 ` Boyd Stephen Smith Jr.
2009-01-13  5:32   ` Imran M Yousuf
2009-01-13  7:51   ` bill lam
2009-01-13 11:20     ` Stephen R. van den Berg
2009-01-13  6:35 ` Sitaram Chamarty
2009-01-13  6:48   ` Matthieu Moy
2009-01-13 11:32     ` Sitaram Chamarty

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).