@matheusbsbs / matheus-bagliano / commits / 6658923070
Fork 0

tutorial: talk about user.name early and don't start with commit -a

Introducing yourself to git early would be a good idea; otherwise the user may not find the mistake until much later when "git log" is learned. Teaching "commit -a" without saying that it is a shortcut for listing the paths to commit leaves the user puzzled. Teach the form with explicit paths first. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Nov 29, 2006 at 00:17 UTC 665892307013bccacb35dd619ae6951c7b209379
1 file changed +24 -5
Documentation/tutorial.txt
+24 -5
@@ -11,6 +11,18 @@ diff" with:
11 $ man git-diff
12 ------------------------------------------------
13
14 +It is a good idea to introduce yourself to git before doing any
15 +operation. The easiest way to do so is:
16 +
17 +------------------------------------------------
18 +$ cat >~/.gitconfig <<\EOF
19 +[user]
20 + name = Your Name Comes Here
21 + email = you@yourdomain.example.com
22 +EOF
23 +------------------------------------------------
24 +
25 +
26 Importing a new project
27 -----------------------
28
@@ -31,7 +43,8 @@ defaulting to local storage area
43
44 You've now initialized the working directory--you may notice a new
45 directory created, named ".git". Tell git that you want it to track
34 -every file under the current directory with
46 +every file under the current directory with (notice the dot '.'
47 +that means the current directory):
48
49 ------------------------------------------------
50 $ git add .
@@ -40,7 +53,7 @@ $ git add .
53 Finally,
54
55 ------------------------------------------------
43 -$ git commit -a
56 +$ git commit
57 ------------------------------------------------
58
59 will prompt you for a commit message, then record the current state
@@ -55,11 +68,17 @@ $ git diff
68 to review your changes. When you're done,
69
70 ------------------------------------------------
58 -$ git commit -a
71 +$ git commit file1 file2...
72 ------------------------------------------------
73
74 will again prompt your for a message describing the change, and then
62 -record the new versions of the modified files.
75 +record the new versions of the files you listed. It is cumbersome
76 +to list all files and you can say `-a` (which stands for 'all')
77 +instead.
78 +
79 +------------------------------------------------
80 +$ git commit -a
81 +------------------------------------------------
82
83 A note on commit messages: Though not required, it's a good idea to
84 begin the commit message with a single short (less than 50 character)
@@ -75,7 +94,7 @@ $ git add path/to/new/file
94 ------------------------------------------------
95
96 then commit as usual. No special command is required when removing a
78 -file; just remove it, then commit.
97 +file; just remove it, then tell `commit` about the file as usual.
98
99 At any point you can view the history of your changes using
100