From 2ff6cea6cf6784470923c2c0d2854529f1a45b2e Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sun, 9 Dec 2018 10:40:10 -0500 Subject: [PATCH 001/677] cleaning: minor rewording, mention "clean.requireForce" config var Signed-off-by: Robert P. J. Day --- book/07-git-tools/sections/stashing-cleaning.asc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/book/07-git-tools/sections/stashing-cleaning.asc b/book/07-git-tools/sections/stashing-cleaning.asc index 215725460..01e113040 100644 --- a/book/07-git-tools/sections/stashing-cleaning.asc +++ b/book/07-git-tools/sections/stashing-cleaning.asc @@ -225,10 +225,9 @@ This is a nice shortcut to recover stashed work easily and work on it in a new b [[_git_clean]] ==== Cleaning your Working Directory -Finally, you may not want to stash some work or files in your working directory, but simply get rid of them. -The `git clean` command will do this for you. +Finally, you may not want to stash some work or files in your working directory, but simply get rid of them; that's what the `git clean` command is for. -Some common reasons for this might be to remove cruft that has been generated by merges or external tools or to remove build artifacts in order to run a clean build. +Some common reasons for cleaning your working directory might be to remove cruft that has been generated by merges or external tools or to remove build artifacts in order to run a clean build. You'll want to be pretty careful with this command, since it's designed to remove files from your working directory that are not tracked. If you change your mind, there is often no retrieving the content of those files. @@ -236,9 +235,9 @@ A safer option is to run `git stash --all` to remove everything but save it in a Assuming you do want to remove cruft files or clean your working directory, you can do so with `git clean`. To remove all the untracked files in your working directory, you can run `git clean -f -d`, which removes any files and also any subdirectories that become empty as a result. -The `-f` means 'force' or "really do this". +The `-f` means 'force' or ``really do this,'' and is required if the Git configuration variable `clean.requireForce` is not explicitly set to false. -If you ever want to see what it would do, you can run the command with the `-n` option, which means ``do a dry run and tell me what you _would_ have removed''. +If you ever want to see what it would do, you can run the command with the `--dry-run` (or `-n`) option, which means ``do a dry run and tell me what you _would_ have removed''. [source,console] ---- From c080a12ad1ca72a854f8f4ee51535d937a09da44 Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Thu, 14 Feb 2019 17:50:49 -0800 Subject: [PATCH 002/677] Make example urls non-clickable --- book/04-git-server/sections/gitlab.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/04-git-server/sections/gitlab.asc b/book/04-git-server/sections/gitlab.asc index 5d42b5fc4..a17d0e5d0 100644 --- a/book/04-git-server/sections/gitlab.asc +++ b/book/04-git-server/sections/gitlab.asc @@ -39,7 +39,7 @@ image::images/gitlab-menu.png[The ``Admin area'' item in the GitLab menu.] Users in GitLab are accounts that correspond to people. User accounts don't have a lot of complexity; mainly it's a collection of personal information attached to login data. Each user account comes with a *namespace*, which is a logical grouping of projects that belong to that user. -If the user +jane+ had a project named +project+, that project's url would be http://server/jane/project[]. +If the user +jane+ had a project named +project+, that project's url would be `http://server/jane/project`. [[gitlab_users]] .The GitLab user administration screen. @@ -56,7 +56,7 @@ This is obviously a much more permanent and destructive action, and its uses are ===== Groups A GitLab group is an assemblage of projects, along with data about how users can access those projects. -Each group has a project namespace (the same way that users do), so if the group +training+ has a project +materials+, its url would be http://server/training/materials[]. +Each group has a project namespace (the same way that users do), so if the group +training+ has a project +materials+, its url would be `http://server/training/materials`. [[gitlab_groups]] .The GitLab group administration screen. From 0d75700d534af0191a830a8115de76c63563490d Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Thu, 14 Feb 2019 17:51:18 -0800 Subject: [PATCH 003/677] Fixes #1032: Remove dead link --- book/B-embedding-git/sections/jgit.asc | 1 - 1 file changed, 1 deletion(-) diff --git a/book/B-embedding-git/sections/jgit.asc b/book/B-embedding-git/sections/jgit.asc index b0ef657a4..dd8696b81 100644 --- a/book/B-embedding-git/sections/jgit.asc +++ b/book/B-embedding-git/sections/jgit.asc @@ -158,4 +158,3 @@ If you're interested and want to learn more, here's where to look for informatio * The official JGit API documentation can be found at http://www.eclipse.org/jgit/documentation/[]. These are standard Javadoc, so your favorite JVM IDE will be able to install them locally, as well. * The JGit Cookbook at https://github.com/centic9/jgit-cookbook[] has many examples of how to do specific tasks with JGit. -* There are several good resources pointed out at http://stackoverflow.com/questions/6861881[]. From 2cb96c2212c090d2ee26ab18eb8f7a3def10e2b2 Mon Sep 17 00:00:00 2001 From: Olleg Samoylov Date: Fri, 15 Feb 2019 13:42:43 +0300 Subject: [PATCH 004/677] Rename 'Git Basics' from chapter 1 to 'What is Git?' Because there is one more 'basics' in the chapter 2. --- book/01-introduction/sections/{basics.asc => what-is-git.asc} | 2 +- ch01-getting-started.asc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename book/01-introduction/sections/{basics.asc => what-is-git.asc} (99%) diff --git a/book/01-introduction/sections/basics.asc b/book/01-introduction/sections/what-is-git.asc similarity index 99% rename from book/01-introduction/sections/basics.asc rename to book/01-introduction/sections/what-is-git.asc index 3207f0090..827e4be1f 100644 --- a/book/01-introduction/sections/basics.asc +++ b/book/01-introduction/sections/what-is-git.asc @@ -1,4 +1,4 @@ -=== Git Basics +=== What is Git? So, what is Git in a nutshell? This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you. diff --git a/ch01-getting-started.asc b/ch01-getting-started.asc index 211b41eca..b5f0d22c2 100644 --- a/ch01-getting-started.asc +++ b/ch01-getting-started.asc @@ -9,7 +9,7 @@ include::book/01-introduction/sections/about-version-control.asc[] include::book/01-introduction/sections/history.asc[] -include::book/01-introduction/sections/basics.asc[] +include::book/01-introduction/sections/what-is-git.asc[] include::book/01-introduction/sections/command-line.asc[] From ef14b95534a23ba3a5e249840e200778764d3134 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Fri, 15 Feb 2019 10:03:40 -0500 Subject: [PATCH 005/677] Recording changes: Replace lone, single hyphen with proper "--" Signed-off-by: Robert P. J. Day --- book/02-git-basics/sections/recording-changes.asc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/02-git-basics/sections/recording-changes.asc b/book/02-git-basics/sections/recording-changes.asc index 99d09ed92..e48751fcf 100644 --- a/book/02-git-basics/sections/recording-changes.asc +++ b/book/02-git-basics/sections/recording-changes.asc @@ -193,7 +193,7 @@ M lib/simplegit.rb ---- New files that aren't tracked have a `??` next to them, new files that have been added to the staging area have an `A`, modified files have an `M` and so on. -There are two columns to the output - the left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working tree. +There are two columns to the output -- the left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working tree. So for example in that output, the `README` file is modified in the working directory but not yet staged, while the `lib/simplegit.rb` file is modified and staged. The `Rakefile` was modified, staged and then modified again, so there are changes to it that are both staged and unstaged. From 1bb44055941d7ba4b6fe044243bfb085f0923a3c Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Fri, 15 Feb 2019 10:14:25 -0500 Subject: [PATCH 006/677] Undoing things: Clarify what "git checkout" does to local files The current explanation of "git checkout -- " seems a bit vague, so expand on it ever so slightly. Signed-off-by: Robert P. J. Day --- book/02-git-basics/sections/undoing.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/02-git-basics/sections/undoing.asc b/book/02-git-basics/sections/undoing.asc index dd75fb7f7..8392b5937 100644 --- a/book/02-git-basics/sections/undoing.asc +++ b/book/02-git-basics/sections/undoing.asc @@ -130,8 +130,8 @@ You can see that the changes have been reverted. [IMPORTANT] ===== It's important to understand that `git checkout -- ` is a dangerous command. -Any changes you made to that file are gone -- Git just copied another file over it. -Don't ever use this command unless you absolutely know that you don't want the file. +Any local changes you made to that file are gone -- Git just copied the most recently-committed version of that file over top of it. +Don't ever use this command unless you absolutely know that you don't want those unsaved local changes. ===== If you would like to keep the changes you've made to that file but still need to get it out of the way for now, we'll go over stashing and branching in <>; these are generally better ways to go. From 2b81e2d639becbdfcc2a6c4c2c4821a941125f52 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 16 Feb 2019 01:58:24 -0500 Subject: [PATCH 007/677] Branching: Add a note about "git checkout -b" Signed-off-by: Robert P. J. Day --- book/03-git-branching/sections/nutshell.asc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/book/03-git-branching/sections/nutshell.asc b/book/03-git-branching/sections/nutshell.asc index 1724caa2a..29eb49792 100644 --- a/book/03-git-branching/sections/nutshell.asc +++ b/book/03-git-branching/sections/nutshell.asc @@ -180,3 +180,9 @@ Also, because we're recording the parents when we commit, finding a proper merge These features help encourage developers to create and use branches often. Let's see why you should do so. + +[NOTE] +.Creating a new branch and switching to it at the same time +==== +It's typical to create a new branch and want to switch to that new branch at the same time -- this can be done in one operation with `git checkout -b `. +==== From 3cf07524629359d307f7d2d119373774bfb283a6 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 16 Feb 2019 01:16:31 -0500 Subject: [PATCH 008/677] Tagging: Small amount of grammatical cleanup, enhance some explanations Among other things: - explain that pushing tags pushes both types - add second variation of how to delete remote tags Signed-off-by: Robert P. J. Day --- book/02-git-basics/sections/tagging.asc | 37 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/book/02-git-basics/sections/tagging.asc b/book/02-git-basics/sections/tagging.asc index d468e18d4..a449b0a06 100644 --- a/book/02-git-basics/sections/tagging.asc +++ b/book/02-git-basics/sections/tagging.asc @@ -2,27 +2,27 @@ === Tagging (((tags))) -Like most VCSs, Git has the ability to tag specific points in history as being important. -Typically people use this functionality to mark release points (v1.0, and so on). -In this section, you'll learn how to list the available tags, how to create new tags, and what the different types of tags are. +Like most VCSs, Git has the ability to tag specific points in a repository's history as being important. +Typically, people use this functionality to mark release points (`v1.0`, `v2.0` and so on). +In this section, you'll learn how to list existing tags, how to create and delete tags, and what the different types of tags are. ==== Listing Your Tags -Listing the available tags in Git is straightforward. +Listing the existing tags in Git is straightforward. Just type `git tag` (with optional `-l` or `--list`):(((git commands, tag))) [source,console] ---- $ git tag -v0.1 -v1.3 +v1.0 +v2.0 ---- -This command lists the tags in alphabetical order; the order in which they appear has no real importance. +This command lists the tags in alphabetical order; the order in which they are displayed has no real importance. You can also search for tags that match a particular pattern. The Git source repo, for instance, contains more than 500 tags. -If you're only interested in looking at the 1.8.5 series, you can run this: +If you're interested only in looking at the 1.8.5 series, you can run this: [source,console] ---- @@ -217,6 +217,12 @@ To git@github.com:schacon/simplegit.git Now, when someone else clones or pulls from your repository, they will get all your tags as well. +[NOTE] +.`git push` pushes both types of tags +==== +Pushing tags using `git push --tags` does not distinguish between lightweight and annotated tags; there is no simple option that allows you to select just one type for pushing. +==== + ==== Deleting Tags To delete a tag on your local repository, you can use `git tag -d `. @@ -229,7 +235,9 @@ Deleted tag 'v1.4-lw' (was e7d5add) ---- Note that this does not remove the tag from any remote servers. -In order to update any remotes, you must use `git push :refs/tags/`: +There are two common variations for deleting a tag from a remote server. + +The first variation is `git push :refs/tags/`: [source,console] ---- @@ -238,9 +246,18 @@ To /git@github.com:schacon/simplegit.git - [deleted] v1.4-lw ---- +The way to interpret the above is to read it as the null value before the colon is being pushed to the remote tag name, effectively deleting it. + +The second (and more intuitive) way to delete a remote tag is with: + +[source,console] +---- +$ git push origin --delete +---- + ==== Checking out Tags -If you want to view the versions of files a tag is pointing to, you can do a git checkout, though this puts your repository in ``detached HEAD'' state, which has some ill side effects: +If you want to view the versions of files a tag is pointing to, you can do a `git checkout` of that tag, although this puts your repository in ``detached HEAD'' state, which has some ill side effects: [source,console] ---- From e0b6ad287043ec4f2b8eeb08b6c28f6a42e5b782 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 16 Feb 2019 04:07:26 -0500 Subject: [PATCH 009/677] Revision selection: Couple minor clarifications and updates Signed-off-by: Robert P. J. Day --- book/07-git-tools/sections/revision-selection.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/07-git-tools/sections/revision-selection.asc b/book/07-git-tools/sections/revision-selection.asc index 9139265e4..21039787d 100644 --- a/book/07-git-tools/sections/revision-selection.asc +++ b/book/07-git-tools/sections/revision-selection.asc @@ -1,7 +1,7 @@ [[_revision_selection]] === Revision Selection -Git allows you to refer to a set of commits or a range of commits in several ways. +Git allows you to refer to a single commit, set of commits, or range of commits in a number of ways. They aren't necessarily obvious but are helpful to know. ==== Single Revisions @@ -60,7 +60,7 @@ a11bef0 first commit ---- Generally, eight to ten characters are more than enough to be unique within a project. -For example, as of June 2018, the Linux kernel (which is a fairly sizable project) has over 700,000 commits and almost six and a half million objects in its object database, with no two objects whose SHA-1s are identical in the first 11 characters. +For example, as of February 2019, the Linux kernel (which is a fairly sizable project) has over 875,000 commits and almost seven million objects in its object database, with no two objects whose SHA-1s are identical in the first 12 characters. [NOTE] .A SHORT NOTE ABOUT SHA-1 From d95889445832eb5c64fa672557a7781baa1b21a6 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 16 Feb 2019 12:51:42 -0500 Subject: [PATCH 010/677] Rewriting history: Minor cleanups; update "git rebase -i" menu Signed-off-by: Robert P. J. Day --- .../sections/rewriting-history.asc | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/book/07-git-tools/sections/rewriting-history.asc b/book/07-git-tools/sections/rewriting-history.asc index e6fdd5fab..a20a34e34 100644 --- a/book/07-git-tools/sections/rewriting-history.asc +++ b/book/07-git-tools/sections/rewriting-history.asc @@ -9,6 +9,7 @@ This can involve changing the order of the commits, changing messages or modifyi In this section, you'll see how to accomplish these tasks so that you can make your commit history look the way you want before you share it with others. [NOTE] +.Don't push your work until you're happy with it ==== One of the cardinal rules of Git is that, since so much work is local within your clone, you have a great deal of freedom to rewrite your history _locally_. However, once you push your work, it is a different story entirely, and you should consider pushed work as final unless you have good reason to change it. @@ -68,8 +69,8 @@ It may be easier to remember the `~3` because you're trying to edit the last thr $ git rebase -i HEAD~3 ---- -Remember again that this is a rebasing command – every commit included in the range `HEAD~3..HEAD` will be rewritten, whether you change the message or not. -Don't include any commit you've already pushed to a central server – doing so will confuse other developers by providing an alternate version of the same change. +Remember again that this is a rebasing command -- every commit included in the range `HEAD~3..HEAD` will be rewritten, whether you change the message or not. +Don't include any commit you've already pushed to a central server -- doing so will confuse other developers by providing an alternate version of the same change. Running this command gives you a list of commits in your text editor that looks something like this: @@ -82,12 +83,20 @@ pick a5f4a0d added cat-file # Rebase 710f0f8..a5f4a0d onto 710f0f8 # # Commands: -# p, pick = use commit -# r, reword = use commit, but edit the commit message -# e, edit = use commit, but stop for amending -# s, squash = use commit, but meld into previous commit -# f, fixup = like "squash", but discard this commit's log message -# x, exec = run command (the rest of the line) using shell +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup = like "squash", but discard this commit's log message +# x, exec = run command (the rest of the line) using shell +# b, break = stop here (continue rebase later with 'git rebase --continue') +# d, drop = remove commit +# l, label