Skip to content

Commit 6658923

Browse files
author
Junio C Hamano
committed
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 <[email protected]>
1 parent 6bee4e4 commit 6658923

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

Documentation/tutorial.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ diff" with:
1111
$ man git-diff
1212
------------------------------------------------
1313

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+
22+
EOF
23+
------------------------------------------------
24+
25+
1426
Importing a new project
1527
-----------------------
1628

@@ -31,7 +43,8 @@ defaulting to local storage area
3143

3244
You've now initialized the working directory--you may notice a new
3345
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):
3548

3649
------------------------------------------------
3750
$ git add .
@@ -40,7 +53,7 @@ $ git add .
4053
Finally,
4154

4255
------------------------------------------------
43-
$ git commit -a
56+
$ git commit
4457
------------------------------------------------
4558

4659
will prompt you for a commit message, then record the current state
@@ -55,11 +68,17 @@ $ git diff
5568
to review your changes. When you're done,
5669

5770
------------------------------------------------
58-
$ git commit -a
71+
$ git commit file1 file2...
5972
------------------------------------------------
6073

6174
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+
------------------------------------------------
6382

6483
A note on commit messages: Though not required, it's a good idea to
6584
begin the commit message with a single short (less than 50 character)
@@ -75,7 +94,7 @@ $ git add path/to/new/file
7594
------------------------------------------------
7695

7796
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.
7998

8099
At any point you can view the history of your changes using
81100

0 commit comments

Comments
 (0)