git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] new tutorial
Date: Sun, 15 Jan 2006 15:26:53 -0800	[thread overview]
Message-ID: <7v64olysw2.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 20060115185458.GA3985@fieldses.org

"J. Bruce Fields" <bfields@fieldses.org> writes:

> OK, now to partially contradict this,...
>...
> I think it makes sense for the main tutorial to address those beginnning
> users, so with this patch I'm proposing that we move
> Documentation/tutorial.txt to Documentation/core-tutorial.txt and
> replace it by a new tutorial.

Well done, and I think this new organization would serve people better.

> ** Documentation/tutorial.txt **
>...
> Finally,
> 
> ------------------------------------------------
> $ git commit -a
> ------------------------------------------------
> 
> will prompt you for a commit message, then record the current state of all the
> files to the repository.

We may want to mention that the canonical commit log message
format is a single line "summary phrase", an empty line, and the
body of the message.  The core does not enforce it, but it is a
good practice to get into because that is more compatible with
the e-mail workflow.  The first line becomes subject and the rest
the message body, and we do not want the first line of an
multi-line sentence to be on the subject line, with the message
body starting in the middle of that sentence.

> This actually pulls from the branch in Bob's repository named "master".  Alice
> could specify a different branch to pull from in a third argument to pull.
> 
>...

A bit narrower fill-column settings, please.

> She can do this by creating a temporary branch just for the purpose of
> studying Bob's changes:
> 
> -------------------------------------
> $ git branch bob-incoming
> $ git checkout bob-incoming
> $ git pull /home/bob/myrepo
> $ git-whatchanged -p
> --------------------------------------

Easier would be:

        $ git fetch /home/bob/myrepo master:refs/heads/bob-incoming
        $ git whatchanged -p HEAD..bob-incoming

You do not have to switch out of your "master" branch only to
fetch into a different branch.  And it is usually a good
discipline not to commit yourself into a branch you use to keep
track of foreign branch.  Which means you do not do the fixup in
bob-incoming branch, but either in your master or another
branch:

	$ git checkout -b bob-fixup bob-incoming
        $ edit
        $ git commit -a -m 'Fixup frotz and filfre'

Then you can:

	$ git checkout master
	$ git pull . bob-fixup

> Fixing Mistakes
>...
> -------------------------------------
> $ git reset --mixed HEAD^
> -------------------------------------

I have a mixed feeling on this one.  I tend to recommend --soft
instead --mixed to people, but both have their pros and cons:

 * "reset --mixed HEAD^" reads the HEAD^ tree into the index, so
   "git diff" shows your changes.  However, it *forgets* all the
   "git add" you did [*1*].

 * "reset --soft HEAD^" does not touch the index, so "git diff"
   would show the same thing as what you would have seen before
   your reset, which means nothing after a commit you regret
   about.  You need to say "git diff --cached".  But it does not
   forget about "git add".

> $ git-cat-file commit 67ad31933f09677d0fed6ac62287f07441b215c6
> tree 4662df01e0e9cfd9b7fab83d7a5234ee651d8804
> parent 9e9b26751a5ca7a257b3e1cfb319fe3e4efc663c
> author J. Bruce Fields <bfields@puzzle.fieldses.org> 1137281075 -0500
> committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1137281075 -0500
> 
> minor copyediting of recent additions to git-commit and git-reset ...

If this is intended to be a beginner documentation, I'd prefer
if it did not talk about cat-file, nor how commit objects are
internally represented.

> Note that by default git pull does not fetch new tags; use
> 
> -------------------------------------
> $ git-fetch --tags
> -------------------------------------
> 
> to get all of the tags from a repository.

These days by default "git fetch" (and "git pull") fetches the
tags that refer to the commits you fetch as part of regular
updates, so this part is mostly redundant.  It still is useful
to slurp tags that do not belong to the commit chain you are
following.

> You can revisit the old state of a tree, and make further modifications
> if you wish, using git branch:
> 
> -------------------------------------
> $ git branch stable-release 67ad31933f09677d
> -------------------------------------

Empirically the first 7 hexdigits are enough (even 5 for small
projects such as git itself).  In fact, in the linux-2.6
repository itself, it appears 5 hexdigits are enough to identify
all 171902 objects (not just commits) uniquely currently, but of
course that would not hold true forever.  16 is way overkill and
an eyesore.


BTW, I do not see the CC'ed copy on list archives and am
wondering why even though I see CC: header in the copy I
received...

BTW^2, it might be interesting to do

	$ git format-patch -C origin..master

the next time around.


[Footnote]

*1* If we taught the index file how to record "intent to add"
(or, "keep an eye on this path for me"), we could fix the
implementation of reset --mixed to take advantage of it.

  parent reply	other threads:[~2006-01-15 23:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-11 23:04 merging initial part of a branch? J. Bruce Fields
2006-01-11 23:47 ` Junio C Hamano
2006-01-12  0:15   ` Andreas Ericsson
2006-01-12  0:24     ` Junio C Hamano
2006-01-12  0:59       ` Andreas Ericsson
2006-01-12  1:13         ` J. Bruce Fields
2006-01-12  0:55   ` J. Bruce Fields
2006-01-12  1:47     ` Junio C Hamano
2006-01-13  3:08       ` J. Bruce Fields
2006-01-13  4:00         ` Junio C Hamano
2006-01-13 15:10           ` J. Bruce Fields
2006-01-13 19:50             ` Junio C Hamano
2006-01-13 20:01               ` J. Bruce Fields
     [not found]                 ` <20060115185458.GA3985@fieldses.org>
2006-01-15 23:26                   ` Junio C Hamano [this message]
2006-01-16  3:57                     ` [PATCH] new tutorial J. Bruce Fields
2006-01-16  5:32                       ` Junio C Hamano
2006-01-23  4:57                     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v64olysw2.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=bfields@fieldses.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).