Skip to contentSkip to conversation

more than 20 commands in everyday.txt

PATCH New Miklos Vajna 3 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

hi,

this might seem to be a bit bikesheding, but i hope it isn't. today i teched git to someone who never used any scm so far. i showed him the "everyday with git" document, as i think it's a great start for newbies. actually i read it once but it was in the past, now i did it again and i think there are some commands listed there which is not something we use "every day". of course it may be only me, that's why i ask. here are the commands i rarely use and are in everyday.txt:

- git-prune and git-repack: usually i use git-gc only. maybe prune and repack could be removed from everyday.txt?

- git-show-branch: what about mentioning gitk instead? i think it's much more used - compared to git-show-branch

what do you think about this? maybe i'm wrong, but if i'm right, then i would provide a patch to update everyday.txt according to these suggestions.

thanks,
- VMiklos

#1 lore raw

PATCH 1/1 everyday: replace 'prune' with 'gc --prune'

This document is for newcomers, so it's good to mention gc for housekeeping tasks instead of running prune manually.

---
 Documentation/everyday.txt |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
Documentation/everyday.txt +3 -5
index ce7c170..a09c1d9 100644
@@ -30,8 +30,6 @@ Everybody uses these commands to maintain git repositories.
 
   * gitlink:git-fsck[1] to check the repository for errors.
 
-  * gitlink:git-prune[1] to remove unused objects in the repository.
-
   * gitlink:git-repack[1] to pack loose objects for efficiency.
 
   * gitlink:git-gc[1] to do common housekeeping tasks such as
@@ -56,13 +54,13 @@ disk space is wasted by not repacking.
 <3> without `-a` repacks incrementally.  repacking every 4-5MB
 of loose objects accumulation may be a good rule of thumb.
 <4> it is easier to use `git gc` than individual housekeeping commands
-such as `prune` and `repack`.  This runs `repack -a -d`.
+such as `prune` and `repack`.
 
 Repack a small project into single pack.::
 +
 ------------
 $ git repack -a -d <1>
-$ git prune
+$ git gc --prune
 ------------
 +
 <1> pack all the objects reachable from the refs into one pack,
@@ -189,7 +187,7 @@ $ git pull <3>
 $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <4>
 $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5>
 $ git reset --hard ORIG_HEAD <6>
-$ git prune <7>
+$ git gc --prune <7>
 $ git fetch --tags <8>
 ------------
 +
Signature · 1 line
1.5.4.rc0.67.gf9c5-dirty
#2 lore raw

PATCH 1/1 everyday: replace 'repack' with 'gc'

Most users don't want to run git repack manually, so suggest using gc instead.

---
 Documentation/everyday.txt |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
Documentation/everyday.txt +4 -9
index a09c1d9..f1993e2 100644
@@ -30,8 +30,6 @@ Everybody uses these commands to maintain git repositories.
 
   * gitlink:git-fsck[1] to check the repository for errors.
 
-  * gitlink:git-repack[1] to pack loose objects for efficiency.
-
   * gitlink:git-gc[1] to do common housekeeping tasks such as
     repack and prune.
 
@@ -43,23 +41,20 @@ Check health and remove cruft.::
 ------------
 $ git fsck <1>
 $ git count-objects <2>
-$ git repack <3>
-$ git gc <4>
+$ git gc <3>
 ------------
 +
 <1> running without `\--full` is usually cheap and assures the
 repository health reasonably well.
 <2> check how many loose objects there are and how much
 disk space is wasted by not repacking.
-<3> without `-a` repacks incrementally.  repacking every 4-5MB
-of loose objects accumulation may be a good rule of thumb.
-<4> it is easier to use `git gc` than individual housekeeping commands
-such as `prune` and `repack`.
+<3> repacks the local repository and performs other housekeeping tasks. Running
+without `--prune` is a safe operation even while other ones are in progress.
 
 Repack a small project into single pack.::
 +
 ------------
-$ git repack -a -d <1>
+$ git gc <1>
 $ git gc --prune
 ------------
 +
Signature · 1 line
1.5.4.rc0.67.gf9c5-dirty
#3 lore raw
In reply to Miklos Vajna
Quoted 6 lines · Miklos Vajna

"every day". of course it may be only me, that's why i ask. here are the commands i rarely use and are in everyday.txt:

- git-prune and git-repack: usually i use git-gc only. maybe prune and repack could be removed from everyday.txt?

Quoted 6 lines

- git-show-branch: what about mentioning gitk instead? i think it's much more used - compared to git-show-branch

what do you think about this? maybe i'm wrong, but if i'm right, then i would provide a patch to update everyday.txt according to these suggestions.

I think you would probably get unanimous yes for the former (I don't use gc myself but "repack -a -d" or "repack -a -d -f" regularly, though --- I am old fashioned and do not mind being counted as an oddball).

For the latter it all depends on whether you are in windowed environment (I usually don't).

#4 lore raw
In reply to Miklos Vajna
Quoted 10 lines · Miklos Vajna

this might seem to be a bit bikesheding, but i hope it isn't. today i teched git to someone who never used any scm so far. i showed him the "everyday with git" document, as i think it's a great start for newbies. actually i read it once but it was in the past, now i did it again and i think there are some commands listed there which is not something we use "every day". of course it may be only me, that's why i ask. here are the commands i rarely use and are in everyday.txt:

- git-prune and git-repack: usually i use git-gc only. maybe prune and repack could be removed from everyday.txt?

I agree that git-repack should be removed (there is git-gc), and git-prune should be replaced by mentioning --prune option to git-gc. This document is for newbies, and they shouldn't need to run anything other than git-gc.

Besides with new enough git the number of generated loose objects should be greatly reduced: git now produces (small) packs if possible.

I'm not sure if mentioning git-fsck at all, or at least this early is a good idea for introductory tutorial. Running git-fsck should be rare, very rare.

Quoted 2 lines

- git-show-branch: what about mentioning gitk instead? i think it's much more used - compared to git-show-branch

I would replace git-show-branch by git-show as command to see where you are. and add gitk (which has now manpage) to view history. git-show-branch output is a bit cryptic...

Perhaps we could add git-reflog / "git log -g" somewhere around?

Quoted 3 lines

what do you think about this? maybe i'm wrong, but if i'm right, then i would provide a patch to update everyday.txt according to these suggestions.

I'd like this. At least the first one is unambiguous.

Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git