diff options
author | Andreas Ericsson <ae@op5.se> | 2008-09-30 11:52:50 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-30 15:16:28 -0700 |
commit | 72c69ebc035efe08aef03866184aa9b344814d93 (patch) | |
tree | 636835a49d191f98bf894e6701cd7f24120130f2 /Documentation/gittutorial-2.txt | |
parent | e502f9e7e6ceb8dfbdb94e2675355847740fc28f (diff) | |
download | git-72c69ebc035efe08aef03866184aa9b344814d93.tar.gz git-72c69ebc035efe08aef03866184aa9b344814d93.tar.xz |
git commit: Reformat output somewhat
Previously, we used to print something along the lines of
Created commit abc9056 on master: Snib the sprock
but that output was sometimes confusing, as many projects use
the "subsystem: message" style of commit subjects (just like
this commit message does). When such improvements are done on
topic-branches, it's not uncommon to name the topic-branch the
same as the subsystem, leading to output like this:
Created commit abc9056 on i386: i386: Snib the sprock
which doesn't look very nice and can be highly confusing.
This patch alters the format so that the noise-word "commit"
is dropped except when it makes the output read better and
the commit subject is put inside parentheses. We also
emphasize the detached case so that users do not overlook it
in case the commit subject is long enough to extend to the
next line. The end result looks thusly:
normal case
Created abc9056 (i386: Snib the sprock) on i386
detached head
Created DETACHED commit abc9056 (i386: Snib the sprock)
While we're at it, we rename "initial commit" to "root-commit"
to align it with the argument to 'git log', producing this:
initial commit
Created root-commit abc9056 (i386: Snib the sprock) on i386
Documentation/gittutorial-2.txt is updated accordingly so that
new users recognize what they're looking at.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'Documentation/gittutorial-2.txt')
-rw-r--r-- | Documentation/gittutorial-2.txt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Documentation/gittutorial-2.txt b/Documentation/gittutorial-2.txt index 660904686..8484e7a02 100644 --- a/Documentation/gittutorial-2.txt +++ b/Documentation/gittutorial-2.txt @@ -32,22 +32,25 @@ Initialized empty Git repository in .git/ $ echo 'hello world' > file.txt $ git add . $ git commit -a -m "initial commit" -Created initial commit 54196cc2703dc165cbd373a65a4dcf22d50ae7f7 +Created root-commit 54196cc (initial commit) on master create mode 100644 file.txt $ echo 'hello world!' >file.txt $ git commit -a -m "add emphasis" -Created commit c4d59f390b9cfd4318117afde11d601c1085f241 +Created c4d59f3 (add emphasis) on master ------------------------------------------------ -What are the 40 digits of hex that git responded to the commit with? +What are the 7 digits of hex that git responded to the commit with? We saw in part one of the tutorial that commits have names like this. It turns out that every object in the git history is stored under -such a 40-digit hex name. That name is the SHA1 hash of the object's +a 40-digit hex name. That name is the SHA1 hash of the object's contents; among other things, this ensures that git will never store the same data twice (since identical data is given an identical SHA1 name), and that the contents of a git object will never change (since -that would change the object's name as well). +that would change the object's name as well). The 7 char hex strings +here are simply the abbreviation of such 40 character long strings. +Abbreviations can be used everywhere where the 40 character strings +can be used, so long as they are unambiguous. It is expected that the content of the commit object you created while following the example above generates a different SHA1 hash than |