Re: What's cooking in git.git (Jul 2014, #04; Tue, 22)

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: What's cooking in git.git (Jul 2014, #04; Tue, 22)

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:02

Junio C Hamano [off-list ref] writes:
"Philip Oakley" [off-list ref] writes:
quoted
quoted
which still makes me feel hesitant to promote this
document without updating its contents, though.
I hadn't viewed it as a 'promotion', rather it was simply ensuring
access to the guide via the help system, instead of leaving it
somewhat hidden.
Stale or incorrect pieces of advice that are hidden will not harm
(non-)readers.  Making them more available would mean giving them
more chances to do harm ;-).
Let's disect it.  I do not have time/concentration to finish all in
one message, so I'll do the first two.

| Everyday Git With 20 Commands Or So
| ===================================
| 
| <<Individual Developer (Standalone)>> commands are essential for
| anybody who makes a commit, even for somebody who works alone.
| 
| If you work with other people, you will need commands listed in
| the <<Individual Developer (Participant)>> section as well.
| 
| People who play the <<Integrator>> role need to learn some more
| commands in addition to the above.
| 
| <<Repository Administration>> commands are for system
| administrators who are responsible for the care and feeding
| of Git repositories.

Let's assume the categorization above is sensible for now.

| Individual Developer (Standalone)[[Individual Developer (Standalone)]]
| ----------------------------------------------------------------------
| 
| A standalone individual developer does not exchange patches with
| other people, and works alone in a single repository, using the
| following commands.
| ...

Everything in the enumeration looks OK except for this one,

|   * linkgit:git-show-branch[1] to see where you are.

which is probably no longer the case, for two reasons.  In the
original design of Git UI, you see many things that encourage you to
view and think about the whole collection of your branches as a whole.
"git show-branch" whose default is to show all of your branches is
just one of them (other examples include "git push" whose default
used to be "matching", expecting that you will work on completing
all the branches before you push the result out for all of them).

Over time, Git UI mutated into put a lot more focus and stress on
the current branch, disregarding what are on the branches you are
not corrently on.  "git log @{u}.." to see how much more you have
done on top of others' work would be more in line with such an
attitude.

I'd suggest dropping this command from this enumeration.

| Examples
| ~~~~~~~~
| 
| Use a tarball as a starting point for a new repository.::
| ...

Perfectly fine.

| Create a topic branch and develop.::
| +
| ------------
| $ git checkout -b alsa-audio <1>
| $ edit/compile/test
| $ git checkout -- curses/ux_audio_oss.c <2>
| $ git add curses/ux_audio_alsa.c <3>
| $ edit/compile/test
| $ git diff HEAD <4>
| $ git commit -a -s <5>

Perefectly fine up to this point.

| $ edit/compile/test
| $ git reset --soft HEAD^ <6>
| $ edit/compile/test
| $ git diff ORIG_HEAD <7>
| $ git commit -a -c ORIG_HEAD <8>

This shows how a typical sequence "I try to further tweak what I
committed" looked like.  With the modern Git, you would do

    $ edit/compile/test
    $ git diff HEAD^ <7>
    $ git commit -a --amend

without the soft reset, which was invented solely because there
wasn't "commit --amend" available.

The example is perfectly fine after this step, but <6> and <8> need
to be dropped and others renumbered.

| Individual Developer (Participant)[[Individual Developer (Participant)]]
| ------------------------------------------------------------------------
| ...
|   * linkgit:git-format-patch[1] to prepare e-mail submission, if
|     you adopt Linux kernel-style public forum workflow.

Probably git-send-email needs to be appended to the end of the
enumeration.

| Examples
| ~~~~~~~~
| 
| Clone the upstream and work on it.  Feed changes to upstream.::
| +
| ------------
| $ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
| $ cd my2.6
| $ edit/compile/test; git commit -a -s <1>
| $ git format-patch origin <2>
| $ git pull <3>
| $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <4>
| $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5>
| $ git reset --hard ORIG_HEAD <6>
| $ git gc <7>
| $ git fetch --tags <8>
| ------------
| +
| <1> repeat as needed.
| <2> extract patches from your branch for e-mail submission.
| <3> `git pull` fetches from `origin` by default and merges into the
| current branch.
| <4> immediately after pulling, look at the changes done upstream
| since last time we checked, only in the
| area we are interested in.
| <5> fetch from a specific branch from a specific repository and merge.
| <6> revert the pull.
| <7> garbage collect leftover objects from reverted pull.
| <8> from time to time, obtain official tags from the `origin`
| and store them under `.git/refs/tags/`.

This example works directly on 'master', which is not ideal.  If I
were writing this today, I would have made it work on 'mine' branch,
produced a patch series out of that branch relative to @{u}, threw
in 'git send-email' invocation, and had "git pull" update the
pristine 'mater' branch after "git checkout master".  Merging of
work by jgarzik (i.e. not your upstream) would also have gone to its
own branch, not to 'master'.

| Push into another repository.::
| +
| ------------
| satellite$ git clone mothership:frotz frotz <1>
| satellite$ cd frotz
| satellite$ git config --get-regexp '^(remote|branch)\.' <2>
| remote.origin.url mothership:frotz
| remote.origin.fetch refs/heads/*:refs/remotes/origin/*
| branch.master.remote origin
| branch.master.merge refs/heads/master

Perfectly fine up to this opint.

| satellite$ git config remote.origin.push \
|            master:refs/remotes/satellite/master <3>

Somewhat iffy; "+refs/heads/*:refs/remotes/satellite/*" would have
been better.  Need to adjust the explanation below.

| satellite$ edit/compile/test/commit
| satellite$ git push origin <4>

Fine, except that the explanation below needs adjustment.

| <3> arrange `git push` to push local `master` branch to
| `remotes/satellite/master` branch of the mothership machine.
| <4> push will stash our work away on `remotes/satellite/master`
| remote-tracking branch on the mothership machine.  You could use this
| as a back-up method.

With wildcarding, we would be backing up all our local branches, not
just master.

| Branch off of a specific tag.::
| +
| ------------
| $ git checkout -b private2.6.14 v2.6.14 <1>
| $ edit/compile/test; git commit -a
| $ git checkout master
| $ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
|   git am -3 -k <2>
| ------------
| +
| <1> create a private branch based on a well known (but somewhat behind)
| tag.
| <2> forward port all changes in `private2.6.14` branch to `master` branch
| without a formal "merging".

The last one is fine, but "cherry-pick v2.6.14..private2.6.14" would
be more common with today's Git.

Re: What's cooking in git.git (Jul 2014, #04; Tue, 22)

From: Philip Oakley <hidden>
Date: 2016-06-15 23:02:03

From: "Junio C Hamano" <redacted>
Sent: Friday, July 25, 2014 11:08 PM
quoted
* po/everyday-doc (2014-01-27) 1 commit
- Make 'git help everyday' work
Let's disect it.  I do not have time/concentration to finish all in
one message, so I'll do the first two.
<snip>

Thanks for the guidance. I'll work on updating the patch in line with 
your comments and see how far I get.

--
Philip 

Everyday contents (was Re: What's cooking in git.git (Jul 2014, #04; Tue, 22))

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:05

Continued: this message only covers the third part (out of the four sections).

| Integrator[[Integrator]]
| ------------------------
| 
| A fairly central person acting as the integrator in a group
| project receives changes made by others, reviews and integrates
| them and publishes the result for others to use, using these
| commands in addition to the ones needed by participants.

This definition of who an "integrator" is, and it being a separate
role when we discuss various workflows, are still sound, I think.

|   * linkgit:git-pull[1] to merge from your trusted lieutenants.

Among these enumerated items, we may want to reword this a little
bit to hint that this section also applies to GitHub pull-request
workflow.  However, I am not sure how their "merge without first
locally checking" action on their website fits in the picture.

| Examples
| ~~~~~~~~
| 
| My typical Git day.::

This probably shouldn't talk about "My" in the first place, but in
any case I work somewhat differently (cf. howto/maintain-git.txt)
these days.

| +
| ------------
| $ git status <1>
| $ git show-branch <2>

This is more like "git branch --no-merged master" (and similarly for
'next' and 'pu'), and is helped by "Meta/cook -w" but this document
is a wrong place to talk about the latter.

| $ mailx <3>
| & s 2 3 4 5 ./+to-apply
| & s 7 8 ./+hold-linus
| & q
| $ git checkout -b topic/one master
| $ git am -3 -i -s -u ./+to-apply <4>

No need to give -u these days.

| $ compile/test
| $ git checkout -b hold/linus && git am -3 -i -s -u ./+hold-linus <5>

Again, no "-u" necessary.

| $ git checkout topic/one && git rebase master <6>
| $ git checkout pu && git reset --hard next <7>
| $ git merge topic/one topic/two && git merge hold/linus <8>
| $ git checkout maint
| $ git cherry-pick master~4 <9>
| $ compile/test
| $ git tag -s -m "GIT 0.99.9x" v0.99.9x <10>
| $ git fetch ko && git show-branch master maint 'tags/ko-*' <11>

This step I still use show-branch, but like this:

    for branch in master maint next pu
    do
        git show-branch ko/$branch $branch
    done

and the purpose explained in the footnote is still valid.

| $ git push ko <12>
| $ git push ko v0.99.9x <13>

I no longer have to do the last step <13>, instead the step <12>
reads more like

	git push --follow-tags ko

| ------------
| +
| <1> see what I was in the middle of doing, if any.
| <2> see what topic branches I have and think about how ready
| they are.

With "show-branch" replaced with "branch --no-merged", the purpose
of this step is still the same.

| <3> read mails, save ones that are applicable, and save others
| that are not quite ready.
| <4> apply them, interactively, with my sign-offs.
| <5> create topic branch as needed and apply, again with my
| sign-offs.
| <6> rebase internal topic branch that has not been merged to the
| master or exposed as a part of a stable branch.
| <7> restart `pu` every time from the next.
| <8> and bundle topic branches still cooking.
| <9> backport a critical fix.
| <10> create a signed tag.
| <11> make sure I did not accidentally rewind master beyond what I
| already pushed out.  `ko` shorthand points at the repository I have
| at kernel.org, and looks like this:

No longer it looks like that ;-)

| +
| ------------
| $ cat .git/remotes/ko
| URL: kernel.org:/pub/scm/git/git.git
| Pull: master:refs/tags/ko-master
| Pull: next:refs/tags/ko-next
| Pull: maint:refs/tags/ko-maint
| Push: master
| Push: next
| Push: +pu
| Push: maint
| ------------
| +

... because we encourage people to use in-config description of
remotes these days, which should look like this:

	(in .git/config)
	[remote "ko"]
        	url = kernel.org:/pub/scm/git/git.git
                fetch = refs/heads/*:refs/remotes/ko/*
                push = refs/heads/master
                push = refs/heads/next
                push = +refs/heads/pu
                push = refs/heads/maint

Also tracking is done via refs/remotes/ko/, no longer with tags/.

| In the output from `git show-branch`, `master` should have
| everything `ko-master` has, and `next` should have
| everything `ko-next` has.

With s|ko-master|ko/master| and s|ko-next|ko/next|, the above is
still valid.

| <12> push out the bleeding edge.

s/edge./edge, together with new tags that point into my history./

| <13> push the tag out, too.

Drop this.

Everday contents (was part of Re: What's cooking in git.git (Jul 2014, #04; Tue, 22))

From: Philip Oakley <hidden>
Date: 2016-06-15 23:02:07

From: "Junio C Hamano" <redacted>
Sent: Friday, July 25, 2014 11:08 PM
...
| Individual Developer (Participant)[[Individual Developer 
(Participant)]]
| ------------------------------------------------------------------------
...
| $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL 
<5>
Would I be right that "ALL" can simply be dropped as something from 
'back then' (13 Dec 2005 v0.99.9-516-g44db136) that I'm ignorant of?

...
| <5> fetch from a specific branch from a specific repository and 
merge.
| <6> revert the pull.
| <7> garbage collect leftover objects from reverted pull.
| <8> from time to time, obtain official tags from the `origin`
| and store them under `.git/refs/tags/`.

This example works directly on 'master', which is not ideal.  If I
were writing this today, I would have made it work on 'mine' branch,
produced a patch series out of that branch relative to @{u}, threw
in 'git send-email' invocation, and had "git pull" update the
pristine 'mater' branch after "git checkout master".  Merging of
work by jgarzik (i.e. not your upstream) would also have gone to its
own branch, not to 'master'.
Slowly working through it ;-)

Ta.

Philip 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help