|
|
@ -1,13 +1,8 @@ |
|
|
|
Everyday GIT With 20 Commands Or So |
|
|
|
Everyday GIT With 20 Commands Or So |
|
|
|
=================================== |
|
|
|
=================================== |
|
|
|
|
|
|
|
|
|
|
|
<<Basic Repository>> commands are needed by people who have a |
|
|
|
<<Individual Developer (Standalone)>> commands are essential for |
|
|
|
repository --- that is everybody, because every working tree of |
|
|
|
anybody who makes a commit, even for somebody who works alone. |
|
|
|
git is a repository. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In addition, <<Individual Developer (Standalone)>> commands are |
|
|
|
|
|
|
|
essential for anybody who makes a commit, even for somebody who |
|
|
|
|
|
|
|
works alone. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you work with other people, you will need commands listed in |
|
|
|
If you work with other people, you will need commands listed in |
|
|
|
the <<Individual Developer (Participant)>> section as well. |
|
|
|
the <<Individual Developer (Participant)>> section as well. |
|
|
@ -20,46 +15,6 @@ administrators who are responsible for the care and feeding |
|
|
|
of git repositories. |
|
|
|
of git repositories. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Basic Repository[[Basic Repository]] |
|
|
|
|
|
|
|
------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Everybody uses these commands to maintain git repositories. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* linkgit:git-init[1] or linkgit:git-clone[1] to create a |
|
|
|
|
|
|
|
new repository. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* linkgit:git-fsck[1] to check the repository for errors. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* linkgit:git-gc[1] to do common housekeeping tasks such as |
|
|
|
|
|
|
|
repack and prune. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples |
|
|
|
|
|
|
|
~~~~~~~~ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Check health and remove cruft.:: |
|
|
|
|
|
|
|
+ |
|
|
|
|
|
|
|
------------ |
|
|
|
|
|
|
|
$ git fsck <1> |
|
|
|
|
|
|
|
$ git count-objects <2> |
|
|
|
|
|
|
|
$ 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> repacks the local repository and performs other housekeeping tasks. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Repack a small project into single pack.:: |
|
|
|
|
|
|
|
+ |
|
|
|
|
|
|
|
------------ |
|
|
|
|
|
|
|
$ git gc <1> |
|
|
|
|
|
|
|
------------ |
|
|
|
|
|
|
|
+ |
|
|
|
|
|
|
|
<1> pack all the objects reachable from the refs into one pack, |
|
|
|
|
|
|
|
then remove the other packs. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Individual Developer (Standalone)[[Individual Developer (Standalone)]] |
|
|
|
Individual Developer (Standalone)[[Individual Developer (Standalone)]] |
|
|
|
---------------------------------------------------------------------- |
|
|
|
---------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
@ -67,6 +22,8 @@ A standalone individual developer does not exchange patches with |
|
|
|
other people, and works alone in a single repository, using the |
|
|
|
other people, and works alone in a single repository, using the |
|
|
|
following commands. |
|
|
|
following commands. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* linkgit:git-init[1] to create a new repository. |
|
|
|
|
|
|
|
|
|
|
|
* linkgit:git-show-branch[1] to see where you are. |
|
|
|
* linkgit:git-show-branch[1] to see where you are. |
|
|
|
|
|
|
|
|
|
|
|
* linkgit:git-log[1] to see what happened. |
|
|
|
* linkgit:git-log[1] to see what happened. |
|
|
|