unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Cluttering the git tree
@ 2014-11-17 20:51 Ulf Jasper
  2014-11-17 22:36 ` David Kastrup
  2014-11-20  5:03 ` Bill Wohler
  0 siblings, 2 replies; 9+ messages in thread
From: Ulf Jasper @ 2014-11-17 20:51 UTC (permalink / raw)
  To: emacs-devel

Hi all,

I just noticed that I cluttered the git tree with my last commit.  All
my intermediate commits which were supposed to be visible only to me
suddenly appeared in the public repository.  Sorry!

I'll study some tutorials before the next commit.  Promised.

Ulf



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

* Re: Cluttering the git tree
  2014-11-17 20:51 Cluttering the git tree Ulf Jasper
@ 2014-11-17 22:36 ` David Kastrup
  2014-11-17 22:53   ` Lars Magne Ingebrigtsen
  2014-11-20  5:03 ` Bill Wohler
  1 sibling, 1 reply; 9+ messages in thread
From: David Kastrup @ 2014-11-17 22:36 UTC (permalink / raw)
  To: emacs-devel

Ulf Jasper <ulf.jasper@web.de> writes:

> Hi all,
>
> I just noticed that I cluttered the git tree with my last commit.  All
> my intermediate commits which were supposed to be visible only to me
> suddenly appeared in the public repository.  Sorry!
>
> I'll study some tutorials before the next commit.  Promised.

The only way _not_ to have intermediate commits be visible (short of
creating a diff and applying it as a single commit) is to prettify your
branch before merging.  git rebase -i is useful for that.

-- 
David Kastrup




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

* Re: Cluttering the git tree
  2014-11-17 22:36 ` David Kastrup
@ 2014-11-17 22:53   ` Lars Magne Ingebrigtsen
  2014-11-17 23:14     ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-17 22:53 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

David Kastrup <dak@gnu.org> writes:

> Ulf Jasper <ulf.jasper@web.de> writes:
>
>> Hi all,
>>
>> I just noticed that I cluttered the git tree with my last commit.  All
>> my intermediate commits which were supposed to be visible only to me
>> suddenly appeared in the public repository.  Sorry!
>>
>> I'll study some tutorials before the next commit.  Promised.
>
> The only way _not_ to have intermediate commits be visible (short of
> creating a diff and applying it as a single commit) is to prettify your
> branch before merging.  git rebase -i is useful for that.

Well, he could just say "git pull --rebase", right?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: Cluttering the git tree
  2014-11-17 22:53   ` Lars Magne Ingebrigtsen
@ 2014-11-17 23:14     ` Andreas Schwab
  2014-11-20  6:18       ` Rob Browning
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2014-11-17 23:14 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: David Kastrup, emacs-devel

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> Ulf Jasper <ulf.jasper@web.de> writes:
>>
>>> Hi all,
>>>
>>> I just noticed that I cluttered the git tree with my last commit.  All
>>> my intermediate commits which were supposed to be visible only to me
>>> suddenly appeared in the public repository.  Sorry!
>>>
>>> I'll study some tutorials before the next commit.  Promised.
>>
>> The only way _not_ to have intermediate commits be visible (short of
>> creating a diff and applying it as a single commit) is to prettify your
>> branch before merging.  git rebase -i is useful for that.
>
> Well, he could just say "git pull --rebase", right?

That doesn't clean up the intermediate commits, it just transplants
them.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

* Re: Cluttering the git tree
  2014-11-17 20:51 Cluttering the git tree Ulf Jasper
  2014-11-17 22:36 ` David Kastrup
@ 2014-11-20  5:03 ` Bill Wohler
  2014-11-20 17:42   ` Ulf Jasper
  1 sibling, 1 reply; 9+ messages in thread
From: Bill Wohler @ 2014-11-20  5:03 UTC (permalink / raw)
  To: emacs-devel

Ulf Jasper <ulf.jasper@web.de> writes:

> Hi all,
>
> I just noticed that I cluttered the git tree with my last commit.  All
> my intermediate commits which were supposed to be visible only to me
> suddenly appeared in the public repository.  Sorry!

Another idea is to put your intermediate commits into a new branch and
then merge them into master with git merge --squash.

-- 
Bill Wohler <wohler@newt.com> aka <Bill.Wohler@nasa.gov>
http://www.newt.com/wohler/
GnuPG ID:610BD9AD




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

* Re: Cluttering the git tree
  2014-11-17 23:14     ` Andreas Schwab
@ 2014-11-20  6:18       ` Rob Browning
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Browning @ 2014-11-20  6:18 UTC (permalink / raw)
  To: Andreas Schwab, Lars Magne Ingebrigtsen; +Cc: David Kastrup, emacs-devel

Andreas Schwab <schwab@linux-m68k.org> writes:

> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

>> Well, he could just say "git pull --rebase", right?
>
> That doesn't clean up the intermediate commits, it just transplants
> them.

And in more detail, it effectively

  1) runs git fetch to update the local copy of the relevant upstream
     branch,

  2) removes all of your pending commits from the current branch,

  3) moves the current branch forward to match the local upstream copy
     that was just fetched,

  4) and then attempts to reapply all of the patches that were removed
     in step 2 to the updated current branch (i.e. the rebase).

If anything goes wrong with a patch in step 4, you'll be walked through
a resolution process (as with all rebases).  And at any point, if you
want to start over, you can run "git rebase --abort".

Hope this helps
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



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

* Re: Cluttering the git tree
  2014-11-20  5:03 ` Bill Wohler
@ 2014-11-20 17:42   ` Ulf Jasper
  2014-11-20 18:27     ` Achim Gratz
  0 siblings, 1 reply; 9+ messages in thread
From: Ulf Jasper @ 2014-11-20 17:42 UTC (permalink / raw)
  To: Bill Wohler; +Cc: emacs-devel

Bill Wohler <wohler@newt.com> writes:

> Ulf Jasper <ulf.jasper@web.de> writes:
>
>> I just noticed that I cluttered the git tree with my last commit.  All
>> my intermediate commits which were supposed to be visible only to me
>> suddenly appeared in the public repository.  Sorry!
>
> Another idea is to put your intermediate commits into a new branch and
> then merge them into master with git merge --squash.

That is, what I was looking for.  Thank you, Bill!

This is how I (will) work: I am not changing files on the master branch
but on a temporary branch, while keeping the master branch synced with
the public repository, like so:

    a - b - c - d    master
         \
          x - y - z  temporary

I am doing commits on the temporary branch so that I can easily switch
branches.  Once I have finished working on the temporary thing I merge
the *results* of that work into the master branch

    git checkout master
    git merge --squash temporary

The magic '--squash' guarantees that there will not be any intermediate
commits.  After resolving merge conflicts it looks as if I had made the
temporary changes directly on the master branch.  After committing the
changed files (with its own commit message) I get

    a - b - c - d - e    master
         \
          x - y - z      temporary

where 'e' now contains all the changes of 'z'.  Now I'm ready to push
'e' to the public repository and delete the temporary branch (with
'-D').  There is just one commit -- nobody will be bothered with any
intermediate commits.  Voila!

Ulf

P.S. I have tried this on a local repository and verified that it
     works. I am quite confident that it will work on the official
     repository as well.  But I may be wrong.  We'll see.  ;)








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

* Re: Cluttering the git tree
  2014-11-20 17:42   ` Ulf Jasper
@ 2014-11-20 18:27     ` Achim Gratz
  2014-11-20 19:01       ` Ulf Jasper
  0 siblings, 1 reply; 9+ messages in thread
From: Achim Gratz @ 2014-11-20 18:27 UTC (permalink / raw)
  To: emacs-devel

Ulf Jasper writes:
>> Another idea is to put your intermediate commits into a new branch and
>> then merge them into master with git merge --squash.
>
> That is, what I was looking for.  Thank you, Bill!

No, that's a terrible idea, please forget it immediately.

> This is how I (will) work: I am not changing files on the master branch
> but on a temporary branch, while keeping the master branch synced with
> the public repository, like so:
>
>     a - b - c - d    master
>          \
>           x - y - z  temporary
>
> I am doing commits on the temporary branch so that I can easily switch
> branches.  Once I have finished working on the temporary thing I merge
> the *results* of that work into the master branch
>
>     git checkout master
>     git merge --squash temporary

Presumably there was some logic for you to do x, y and z in that order.
If you squash, that gets lost to anyone reading the change.  If you want
to present a different logic now that you've implemented everything you
should maybe rewrite your branch to t-u-v-w, but certainly not squash
it.  Unless it really is a trivial thing that should have been a single
commit all along.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada




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

* Re: Cluttering the git tree
  2014-11-20 18:27     ` Achim Gratz
@ 2014-11-20 19:01       ` Ulf Jasper
  0 siblings, 0 replies; 9+ messages in thread
From: Ulf Jasper @ 2014-11-20 19:01 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-devel

Achim Gratz <Stromeko@nexgo.de> writes:

> Presumably there was some logic for you to do x, y and z in that order.
> If you squash, that gets lost to anyone reading the change.  If you want
> to present a different logic now that you've implemented everything you
> should maybe rewrite your branch to t-u-v-w, but certainly not squash
> it.  Unless it really is a trivial thing that should have been a single
> commit all along.

Yes, I was talking about trivial things that should be single commits.
Sorry that I did not make that clear.

I am used to do small steps, even for trivial things.  Once the solution
is found it easy to go back and do one regular step instead.  Nobody
wants to know how I have been stumbling around.

Ulf



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

end of thread, other threads:[~2014-11-20 19:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 20:51 Cluttering the git tree Ulf Jasper
2014-11-17 22:36 ` David Kastrup
2014-11-17 22:53   ` Lars Magne Ingebrigtsen
2014-11-17 23:14     ` Andreas Schwab
2014-11-20  6:18       ` Rob Browning
2014-11-20  5:03 ` Bill Wohler
2014-11-20 17:42   ` Ulf Jasper
2014-11-20 18:27     ` Achim Gratz
2014-11-20 19:01       ` Ulf Jasper

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

	https://git.savannah.gnu.org/cgit/emacs.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).