@@ -9,11 +9,11 @@ repository, mainly because being hands-on and using explicit examples is
9
9
often the best way of explaining what is going on.
10
10
11
11
In normal life, most people wouldn't use the "core" git programs
12
- directly, but rather script around them to make them more palatable.
12
+ directly, but rather script around them to make them more palatable.
13
13
Understanding the core git stuff may help some people get those scripts
14
14
done, though, and it may also be instructive in helping people
15
15
understand what it is that the higher-level helper scripts are actually
16
- doing.
16
+ doing.
17
17
18
18
The core git is often called "plumbing", with the prettier user
19
19
interfaces on top of it called "porcelain". You may not want to use the
@@ -41,7 +41,7 @@ Creating a new git repository couldn't be easier: all git repositories start
41
41
out empty, and the only thing you need to do is find yourself a
42
42
subdirectory that you want to use as a working tree - either an empty
43
43
one for a totally new project, or an existing working tree that you want
44
- to import into git.
44
+ to import into git.
45
45
46
46
For our first example, we're going to start a totally new repository from
47
47
scratch, with no pre-existing files, and we'll call it `git-tutorial`.
@@ -169,7 +169,7 @@ $ ls .git/objects/??/*
169
169
and see two files:
170
170
171
171
----------------
172
- .git/objects/55/7db03de997c86a4a028e1ebd3a1ceb225be238
172
+ .git/objects/55/7db03de997c86a4a028e1ebd3a1ceb225be238
173
173
.git/objects/f2/4c74a2e500f5ee1332c86b94199f52b1d1d962
174
174
----------------
175
175
@@ -220,7 +220,7 @@ you have not actually really "checked in" your files into git so far,
220
220
you've only *told* git about them.
221
221
222
222
However, since git knows about them, you can now start using some of the
223
- most basic git commands to manipulate the files or look at their status.
223
+ most basic git commands to manipulate the files or look at their status.
224
224
225
225
In particular, let's not even check in the two files into git yet, we'll
226
226
start off by adding another line to `hello` first:
@@ -350,7 +350,7 @@ Making a change
350
350
351
351
Remember how we did the `git-update-index` on file `hello` and then we
352
352
changed `hello` afterward, and could compare the new state of `hello` with the
353
- state we saved in the index file?
353
+ state we saved in the index file?
354
354
355
355
Further, remember how I said that `git-write-tree` writes the contents
356
356
of the *index* file to the tree, and thus what we just committed was in
@@ -370,7 +370,7 @@ file and the working tree, `git-diff-index` shows the differences
370
370
between a committed *tree* and either the index file or the working
371
371
tree. In other words, `git-diff-index` wants a tree to be diffed
372
372
against, and before we did the commit, we couldn't do that, because we
373
- didn't have anything to diff against.
373
+ didn't have anything to diff against.
374
374
375
375
But now we can do
376
376
@@ -379,7 +379,7 @@ $ git-diff-index -p HEAD
379
379
----------------
380
380
381
381
(where `-p` has the same meaning as it did in `git-diff-files`), and it
382
- will show us the same difference, but for a totally different reason.
382
+ will show us the same difference, but for a totally different reason.
383
383
Now we're comparing the working tree not against the index file,
384
384
but against the tree we just wrote. It just so happens that those two
385
385
are obviously the same, so we get the same result.
@@ -398,7 +398,7 @@ working tree, but when given the `\--cached` flag, it is told to
398
398
instead compare against just the index cache contents, and ignore the
399
399
current working tree state entirely. Since we just wrote the index
400
400
file to HEAD, doing `git-diff-index \--cached -p HEAD` should thus return
401
- an empty set of differences, and that's exactly what it does.
401
+ an empty set of differences, and that's exactly what it does.
402
402
403
403
[NOTE]
404
404
================
@@ -549,7 +549,7 @@ $ git-whatchanged -p --root
549
549
----------------
550
550
551
551
and you will see exactly what has changed in the repository over its
552
- short history.
552
+ short history.
553
553
554
554
[NOTE]
555
555
The `\--root` flag is a flag to `git-diff-tree` to tell it to
@@ -637,7 +637,7 @@ So the mental model of "the git information is always tied directly to
637
637
the working tree that it describes" may not be technically 100%
638
638
accurate, but it's a good model for all normal use.
639
639
640
- This has two implications:
640
+ This has two implications:
641
641
642
642
- if you grow bored with the tutorial repository you created (or you've
643
643
made a mistake and want to start all over), you can just do simple
@@ -705,7 +705,7 @@ Many (most?) public remote repositories will not contain any of
705
705
the checked out files or even an index file, and will *only* contain the
706
706
actual core git files. Such a repository usually doesn't even have the
707
707
`.git` subdirectory, but has all the git files directly in the
708
- repository.
708
+ repository.
709
709
710
710
To create your own local live copy of such a "raw" git repository, you'd
711
711
first create your own subdirectory for the project, and then copy the
@@ -718,7 +718,7 @@ $ cd my-git
718
718
$ rsync -rL rsync://rsync.kernel.org/pub/scm/git/git.git/ .git
719
719
----------------
720
720
721
- followed by
721
+ followed by
722
722
723
723
----------------
724
724
$ git-read-tree HEAD
@@ -738,7 +738,7 @@ up-to-date (so that you don't have to refresh it afterward), and the
738
738
`-a` flag means "check out all files" (if you have a stale copy or an
739
739
older version of a checked out tree you may also need to add the `-f`
740
740
flag first, to tell git-checkout-index to *force* overwriting of any old
741
- files).
741
+ files).
742
742
743
743
Again, this can all be simplified with
744
744
@@ -751,7 +751,7 @@ $ git checkout
751
751
which will end up doing all of the above for you.
752
752
753
753
You have now successfully copied somebody else's (mine) remote
754
- repository, and checked it out.
754
+ repository, and checked it out.
755
755
756
756
757
757
Creating a new branch
@@ -760,14 +760,14 @@ Creating a new branch
760
760
Branches in git are really nothing more than pointers into the git
761
761
object database from within the `.git/refs/` subdirectory, and as we
762
762
already discussed, the `HEAD` branch is nothing but a symlink to one of
763
- these object pointers.
763
+ these object pointers.
764
764
765
765
You can at any time create a new branch by just picking an arbitrary
766
766
point in the project history, and just writing the SHA1 name of that
767
767
object into a file under `.git/refs/heads/`. You can use any filename you
768
768
want (and indeed, subdirectories), but the convention is that the
769
769
"normal" branch is called `master`. That's just a convention, though,
770
- and nothing enforces it.
770
+ and nothing enforces it.
771
771
772
772
To show that as an example, let's go back to the git-tutorial repository we
773
773
used earlier, and create a branch in it. You do that by simply just
@@ -778,7 +778,7 @@ $ git checkout -b mybranch
778
778
------------
779
779
780
780
will create a new branch based at the current `HEAD` position, and switch
781
- to it.
781
+ to it.
782
782
783
783
[NOTE]
784
784
================================================
@@ -825,7 +825,7 @@ checking it out and switching to it. If so, just use the command
825
825
$ git branch <branchname> [startingpoint]
826
826
------------
827
827
828
- which will simply _create_ the branch, but will not do anything further.
828
+ which will simply _create_ the branch, but will not do anything further.
829
829
You can then later -- once you decide that you want to actually develop
830
830
on that branch -- switch to that branch with a regular `git checkout`
831
831
with the branchname as the argument.
@@ -884,7 +884,7 @@ $ gitk --all
884
884
will show you graphically both of your branches (that's what the `\--all`
885
885
means: normally it will just show you your current `HEAD`) and their
886
886
histories. You can also see exactly how they came to be from a common
887
- source.
887
+ source.
888
888
889
889
Anyway, let's exit `gitk` (`^Q` or the File menu), and decide that we want
890
890
to merge the work we did on the `mybranch` branch into the `master`
@@ -905,8 +905,8 @@ of it as it can automatically (which in this case is just merge the `example`
905
905
file, which had no differences in the `mybranch` branch), and say:
906
906
907
907
----------------
908
- Auto-merging hello
909
- CONFLICT (content): Merge conflict in hello
908
+ Auto-merging hello
909
+ CONFLICT (content): Merge conflict in hello
910
910
Automatic merge failed; fix up by hand
911
911
----------------
912
912
@@ -1387,7 +1387,7 @@ repository. Kernel.org mirror network takes care of the
1387
1387
propagation to other publicly visible machines:
1388
1388
1389
1389
------------
1390
- $ git push master.kernel.org:/pub/scm/git/git.git/
1390
+ $ git push master.kernel.org:/pub/scm/git/git.git/
1391
1391
------------
1392
1392
1393
1393
0 commit comments