git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Adapt tutorial to cygwin and add test case

From
Junio C Hamano <junkio@cox.net>
Date
Oct 11, 2005, 19:57 UTC
Message-ID
<7vu0fnsu6f.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0510111333160.27109@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 11 quoted lines
> -And this is where we start using the `.git/HEAD` file. The `HEAD` file is
> +And this is where we create the `.git/refs/heads/master` file. This file is
>  supposed to contain the reference to the top-of-tree, and since that's
>  exactly what `git-commit-tree` spits out, we can do this all with a simple
>  shell pipeline:
>  
>  ------------------------------------------------
> -echo "Initial commit" | git-commit-tree $(git-write-tree) > .git/HEAD
> +echo "Initial commit" | \
> +	git-commit-tree $(git-write-tree) > .git/refs/heads/master
>  ------------------------------------------------

Hmm. This is not wrong, but does not feel right. The point we are explaining here is that there is a HEAD pointer that knows about the current branch, and after making a commit, we update it to record the new tip of the branch.

The Kosher way would be
    tree=$(git-write-tree)
    commit=$(echo 'Initial commit' | git-commit-tree $tree)
    git-update-ref HEAD $(commit)
but looks quite intimidating as a tutorial material.  
Show 8 quoted lines
> @@ -691,7 +695,9 @@ other point in the history than the curr
>  just telling `git checkout` what the base of the checkout would be.
>  In other words, if you have an earlier tag or branch, you'd just do
>  
> -	git checkout -b mybranch earlier-commit
> +------------
> +git checkout -b mybranch earlier-commit
> +------------

The original was both ugly and did not use boxquote. There is no excuse for ugliness, but not using boxquote was for a reason. The boxquoted "type this" examples were not to be missed, lest the later steps we explain would either not work or would produce results that is different from what we show. This particular step is "if you were doing something different, you would do this", implying "but do not do that here if you are following the tutorial steps because that is not what we are doing here". Maybe we should use boxquote but make an explicit comment that this is a tangent here?

Show 8 quoted lines
> @@ -699,17 +705,29 @@ and check out the state at that time.
>  
>  You can always just jump back to your original `master` branch by doing
>  
> -	git checkout master
> +------------
> +git checkout master
> +------------
Same here.
Show 10 quoted lines
> @@ -870,8 +889,10 @@ Now, let's pretend you are the one who d
>  to the `master` branch. Let's go back to `mybranch`, and run
>  resolve to get the "upstream changes" back to your branch.
>  
> -	git checkout mybranch
> -	git resolve HEAD master "Merge upstream changes."
> +------------
> +git checkout mybranch
> +git resolve HEAD master "Merge upstream changes."
> +------------
But not here.
> diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
> new file mode 100644
> index 0000000..35db799
This is an extremely good addition, thanks.
Previous: Johannes SchindelinNext: Matthias Urlichs
Message 2 of 5 in “Adapt tutorial to cygwin and add test case”
  1. Adapt tutorial to cygwin and add test caseJohannes Schindelin, Oct 11, 2005
  2. Junio C HamanoOct 11, 2005
  3. Matthias UrlichsOct 12, 2005
  4. Johannes SchindelinOct 12, 2005
  5. Johannes SchindelinOct 12, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.