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>maint
parent
6bee4e408c
commit
6658923070
|
@ -11,6 +11,18 @@ diff" with:
|
||||||
$ man git-diff
|
$ man git-diff
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
|
It is a good idea to introduce yourself to git before doing any
|
||||||
|
operation. The easiest way to do so is:
|
||||||
|
|
||||||
|
------------------------------------------------
|
||||||
|
$ cat >~/.gitconfig <<\EOF
|
||||||
|
[user]
|
||||||
|
name = Your Name Comes Here
|
||||||
|
email = you@yourdomain.example.com
|
||||||
|
EOF
|
||||||
|
------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
Importing a new project
|
Importing a new project
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
@ -31,7 +43,8 @@ defaulting to local storage area
|
||||||
|
|
||||||
You've now initialized the working directory--you may notice a new
|
You've now initialized the working directory--you may notice a new
|
||||||
directory created, named ".git". Tell git that you want it to track
|
directory created, named ".git". Tell git that you want it to track
|
||||||
every file under the current directory with
|
every file under the current directory with (notice the dot '.'
|
||||||
|
that means the current directory):
|
||||||
|
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
$ git add .
|
$ git add .
|
||||||
|
@ -40,7 +53,7 @@ $ git add .
|
||||||
Finally,
|
Finally,
|
||||||
|
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
$ git commit -a
|
$ git commit
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
will prompt you for a commit message, then record the current state
|
will prompt you for a commit message, then record the current state
|
||||||
|
@ -55,11 +68,17 @@ $ git diff
|
||||||
to review your changes. When you're done,
|
to review your changes. When you're done,
|
||||||
|
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
$ git commit -a
|
$ git commit file1 file2...
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
will again prompt your for a message describing the change, and then
|
will again prompt your for a message describing the change, and then
|
||||||
record the new versions of the modified files.
|
record the new versions of the files you listed. It is cumbersome
|
||||||
|
to list all files and you can say `-a` (which stands for 'all')
|
||||||
|
instead.
|
||||||
|
|
||||||
|
------------------------------------------------
|
||||||
|
$ git commit -a
|
||||||
|
------------------------------------------------
|
||||||
|
|
||||||
A note on commit messages: Though not required, it's a good idea to
|
A note on commit messages: Though not required, it's a good idea to
|
||||||
begin the commit message with a single short (less than 50 character)
|
begin the commit message with a single short (less than 50 character)
|
||||||
|
@ -75,7 +94,7 @@ $ git add path/to/new/file
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
then commit as usual. No special command is required when removing a
|
then commit as usual. No special command is required when removing a
|
||||||
file; just remove it, then commit.
|
file; just remove it, then tell `commit` about the file as usual.
|
||||||
|
|
||||||
At any point you can view the history of your changes using
|
At any point you can view the history of your changes using
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue