Skip to contentSkip to conversation

Documentation/tutorial: misc updates

PATCH In review Santi Béjar 4 participants 7 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation/tutorial: misc updates

Three changes:
1) Teach how to delete a branch with "git branch -d name".
2) The first commit does not have a parent.
3) Teach "git show" instead of "git cat-file -p".

---
 Documentation/tutorial.txt |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
Documentation/tutorial.txt +13 -4
index d043e84..f0a5526 100644
@@ -222,6 +222,15 @@ $ gitk
 
 will show a nice graphical representation of the resulting history.
 
+At this point you could delete the experimental branch with
+
+------------------------------------------------
+$ git branch -d experimental
+------------------------------------------------
+
+This command ensures that the changes in the experimental branch are
+already in the current branch.
+
 If you develop on a branch crazy-idea, then regret it, you can always
 delete the branch with
 
@@ -391,8 +400,8 @@ $ git show HEAD		# the tip of the current branch
 $ git show experimental	# the tip of the "experimental" branch
 -------------------------------------
 
-Every commit has at least one "parent" commit, which points to the
-previous state of the project:
+Every commit has at least one "parent" commit (except the first),
+which points to the previous state of the project:
 
 -------------------------------------
 $ git show HEAD^  # to see the parent of HEAD
@@ -510,10 +519,10 @@ of the file:
 $ git diff v2.5:Makefile HEAD:Makefile.in
 -------------------------------------
 
-You can also use "git cat-file -p" to see any such file:
+You can also use "git show" to see any such file:
 
 -------------------------------------
-$ git cat-file -p v2.5:Makefile
+$ git show v2.5:Makefile
 -------------------------------------
 
 Next Steps
Signature · 1 line
1.5.0.rc0.g91ea
#1 lore raw
Quoted 15 lines · Santi Béjar

Three changes:
1) Teach how to delete a branch with "git branch -d name".
2) The first commit does not have a parent.
3) Teach "git show" instead of "git cat-file -p".

---
 Documentation/tutorial.txt |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
Documentation/tutorial.txt +0 -0
index d043e84..f0a5526 100644
@@ -222,6 +222,15 @@ $ gitk
 
 will show a nice graphical representation of the resulting history.

Documentation/tutorial.txt $ gitk · line 233

Quoted 10 lines
Documentation/tutorial.txt +9 -0
 
+At this point you could delete the experimental branch with
+
+------------------------------------------------
+$ git branch -d experimental
+------------------------------------------------
+
+This command ensures that the changes in the experimental branch are
+already in the current branch.
+

Huh? This deletes the branch, it doesn't ensure changes have been saved.

Documentation/tutorial.txt $ git show HEAD # the tip of the current branch · line 404

Quoted 11 lines
Documentation/tutorial.txt +2 -2
 If you develop on a branch crazy-idea, then regret it, you can always
 delete the branch with
 
@@ -391,8 +400,8 @@ $ git show HEAD		# the tip of the current branch
 $ git show experimental	# the tip of the "experimental" branch
 -------------------------------------
 
-Every commit has at least one "parent" commit, which points to the
-previous state of the project:
+Every commit has at least one "parent" commit (except the first),
+which points to the previous state of the project:

And how can it have more than one parent? If you mention it, better come clean about merges (can be explained in detail later).

Documentation/tutorial.txt $ git show HEAD # the tip of the current branch · line 406

Quoted 2 lines
Documentation/tutorial.txt +0 -0
 -------------------------------------
 $ git show HEAD^  # to see the parent of HEAD

And if there are several parents?

Documentation/tutorial.txt of the file: · line 520

Quoted 3 lines
Documentation/tutorial.txt +0 -0
@@ -510,10 +519,10 @@ of the file:
 $ git diff v2.5:Makefile HEAD:Makefile.in
 -------------------------------------

HEAD:Makefile.in doesn't need HEAD.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513
#2 lore raw
Quoted 17 lines · Horst H. von Brand
Quoted 16 lines · Santi Béjar

Three changes:
1) Teach how to delete a branch with "git branch -d name".
2) The first commit does not have a parent.
3) Teach "git show" instead of "git cat-file -p".

---
 Documentation/tutorial.txt |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
Documentation/tutorial.txt +0 -0
index d043e84..f0a5526 100644
@@ -222,6 +222,15 @@ $ gitk
 
 will show a nice graphical representation of the resulting history.
 
Quoted 11 lines

Documentation/tutorial.txt $ gitk · line 233

Quoted 9 lines
Documentation/tutorial.txt +9 -0
+At this point you could delete the experimental branch with
+
+------------------------------------------------
+$ git branch -d experimental
+------------------------------------------------
+
+This command ensures that the changes in the experimental branch are
+already in the current branch.
+

Huh? This deletes the branch, it doesn't ensure changes have been saved.

It deletes the branch only if the current branch is fast-forwarding it.

Could be rephrase as:

This command only delete the experimental branch if it is already merge in the current branch.

Quoted 8 lines
Quoted 8 lines
Documentation/tutorial.txt +0 -0
 If you develop on a branch crazy-idea, then regret it, you can always
 delete the branch with
 
@@ -391,8 +400,8 @@ $ git show HEAD           # the tip of the current branch
 $ git show experimental      # the tip of the "experimental" branch
 -------------------------------------
 
Quoted 7 lines

Documentation/tutorial.txt $ git show HEAD # the tip of the current branch · line 404

Quoted 4 lines
Documentation/tutorial.txt +2 -2
-Every commit has at least one "parent" commit, which points to the
-previous state of the project:
+Every commit has at least one "parent" commit (except the first),
+which points to the previous state of the project:

And how can it have more than one parent? If you mention it, better come clean about merges (can be explained in detail later).

I have not mentined it, I've just added the exception that the firt/root commits have zero parents.

Quoted 5 lines

Documentation/tutorial.txt $ git show HEAD # the tip of the current branch · line 406

Quoted 3 lines
Documentation/tutorial.txt +0 -0
 -------------------------------------
 $ git show HEAD^  # to see the parent of HEAD

And if there are several parents?

Already explained before.

Quoted 6 lines

Documentation/tutorial.txt of the file: · line 520

Quoted 4 lines
Documentation/tutorial.txt +0 -0
@@ -510,10 +519,10 @@ of the file:
 $ git diff v2.5:Makefile HEAD:Makefile.in
 -------------------------------------

HEAD:Makefile.in doesn't need HEAD.

Not needed if the Makefile.in in the working directory is equal to the file in HEAD.
But better explain new things.

Santi

#3 lore raw
Quoted 11 lines · Santi Béjar
Quoted 9 lines · Horst H. von Brand

Review

Quoted 5 lines · Santi Béjar
(quoted diff) +2 -2
-Every commit has at least one "parent" commit, which points to the
-previous state of the project:
+Every commit has at least one "parent" commit (except the first),
+which points to the previous state of the project:

And how can it have more than one parent? If you mention it, better come clean about merges (can be explained in detail later).

Quoted 2 lines

I have not mentined it, I've just added the exception that the firt/root commits have zero parents.

Well, it does not matter who originally is at fault ;-).

Let's just do this.

Documentation/tutorial.txt +1 -1
index f0a5526..0cc234f 100644
@@ -400,7 +400,7 @@ $ git show HEAD		# the tip of the current branch
 $ git show experimental	# the tip of the "experimental" branch
 -------------------------------------
 
-Every commit has at least one "parent" commit (except the first),
+Every commit usually has one "parent" commit
 which points to the previous state of the project:
 
 -------------------------------------

After this paragraph, we say "merge has more than one", so it's all consistent and presented in the right order. By the time the reader starts wondering about the initial commit, we've shown the use of HEAD^^^^ and HEAD~$n enough that the reader can experiment on his/her own.

#4 lore raw
Quoted 13 lines · Junio C Hamano
Quoted 11 lines · Santi Béjar
Quoted 9 lines · Horst H. von Brand

Review

Quoted 5 lines · Santi Béjar
(quoted diff) +2 -2
-Every commit has at least one "parent" commit, which points to the
-previous state of the project:
+Every commit has at least one "parent" commit (except the first),
+which points to the previous state of the project:

And how can it have more than one parent? If you mention it, better come clean about merges (can be explained in detail later).

Quoted 4 lines
Quoted 2 lines

I have not mentined it, I've just added the exception that the firt/root commits have zero parents.

Well, it does not matter who originally is at fault ;-).

Sure, we all try to make git better and better.

Quoted 17 lines

Let's just do this.

Documentation/tutorial.txt +1 -1
index f0a5526..0cc234f 100644
@@ -400,7 +400,7 @@ $ git show HEAD             # the tip of the current branch
 $ git show experimental        # the tip of the "experimental" branch
 -------------------------------------
 
-Every commit has at least one "parent" commit (except the first),
+Every commit usually has one "parent" commit
 which points to the previous state of the project:
 
 -------------------------------------
Quoted 5 lines

After this paragraph, we say "merge has more than one", so it's all consistent and presented in the right order. By the time the reader starts wondering about the initial commit, we've shown the use of HEAD^^^^ and HEAD~$n enough that the reader can experiment on his/her own.

OK here.

Santi

#5 lore raw
In reply to Horst H. von Brand
Quoted 9 lines · Horst H. von Brand

Documentation/tutorial.txt $ gitk · line 233

Quoted 7 lines

+------------------------------------------------
+$ git branch -d experimental
+------------------------------------------------

Documentation/tutorial.txt +4 -0
+
+This command ensures that the changes in the experimental branch are
+already in the current branch.
+

Huh? This deletes the branch, it doesn't ensure changes have been saved.

It ensures that the branch we want to delete is in lineage of current branch (otherwise we would have to use -D).

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#6 lore raw
Quoted 12 lines · Jakub Narebski
Quoted 9 lines · Horst H. von Brand

Documentation/tutorial.txt $ gitk · line 233

Quoted 7 lines

+------------------------------------------------
+$ git branch -d experimental
+------------------------------------------------

Documentation/tutorial.txt +4 -0
+
+This command ensures that the changes in the experimental branch are
+already in the current branch.
+

Huh? This deletes the branch, it doesn't ensure changes have been saved.

Quoted 2 lines

It ensures that the branch we want to delete is in lineage of current branch (otherwise we would have to use -D).

I know. But it doesn't "ensure" anything, the /user/ has to ensure beforehand that there are no outstanding changes for it to succeed. Fine distinction, I know. But better be extra clear.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513