You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/getting-a-repository.asc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,9 @@ For example, if you want to clone the Git linkable library called libgit2, you c
46
46
$ git clone https://github.com/libgit2/libgit2
47
47
----
48
48
49
-
That creates a directory named ``libgit2'', initializes a `.git` directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version.
49
+
That creates a directory named "`libgit2`", initializes a `.git` directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version.
50
50
If you go into the new `libgit2` directory, you’ll see the project files in there, ready to be worked on or used.
51
-
If you want to clone the repository into a directory named something other than ``libgit2'', you can specify that as the next command-line option:
51
+
If you want to clone the repository into a directory named something other than "`libgit2`", you can specify that as the next command-line option:
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/recording-changes.asc
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ nothing to commit, working directory clean
29
29
This means you have a clean working directory – in other words, there are no tracked and modified files.
30
30
Git also doesn’t see any untracked files, or they would be listed here.
31
31
Finally, the command tells you which branch you’re on and informs you that it has not diverged from the same branch on the server.
32
-
For now, that branch is always ``master'', which is the default; you won’t worry about it here.
32
+
For now, that branch is always "`master`", which is the default; you won’t worry about it here.
33
33
<<_git_branching>> will go over branches and references in detail.
34
34
35
35
Let’s say you add a new file to your project, a simple README file.
@@ -48,7 +48,7 @@ Untracked files:
48
48
nothing added to commit but untracked files present (use "git add" to track)
49
49
----
50
50
51
-
You can see that your new README file is untracked, because it’s under the ``Untracked files'' heading in your status output.
51
+
You can see that your new README file is untracked, because it’s under the "`Untracked files`" heading in your status output.
52
52
Untracked basically means that Git sees a file you didn’t have in the previous snapshot (commit); Git won’t start including it in your commit snapshots until you explicitly tell it to do so.
53
53
It does this so you don’t accidentally begin including generated binary files or other files that you did not mean to include.
54
54
You do want to start including README, so let’s start tracking the file.
@@ -76,15 +76,15 @@ Changes to be committed:
76
76
77
77
----
78
78
79
-
You can tell that it’s staged because it’s under the ``Changes to be committed'' heading.
79
+
You can tell that it’s staged because it’s under the "`Changes to be committed`" heading.
80
80
If you commit at this point, the version of the file at the time you ran `git add` is what will be in the historical snapshot.
81
81
You may recall that when you ran `git init` earlier, you then ran `git add (files)` – that was to begin tracking files in your directory.(((git commands, init)))(((git commands, add)))
82
82
The `git add` command takes a path name for either a file or a directory; if it’s a directory, the command adds all the files in that directory recursively.
83
83
84
84
==== Staging Modified Files
85
85
86
86
Let’s change a file that was already tracked.
87
-
If you change a previously tracked file called ``benchmarks.rb'' and then run your `git status` command again, you get something that looks like this:
87
+
If you change a previously tracked file called "`benchmarks.rb`" and then run your `git status` command again, you get something that looks like this:
88
88
89
89
[source,shell]
90
90
----
@@ -103,9 +103,9 @@ Changes not staged for commit:
103
103
104
104
----
105
105
106
-
The ``benchmarks.rb'' file appears under a section named ``Changed but not staged for commit'' – which means that a file that is tracked has been modified in the working directory but not yet staged.
107
-
To stage it, you run the `git add` command. `git add` is a multipurpose command – you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. It may be helpful to think of it more as ``add this content to the next commit'' rather than ``add this file to the project''.(((git commands, add)))
108
-
Let’s run `git add` now to stage the ``benchmarks.rb'' file, and then run `git status` again:
106
+
The "`benchmarks.rb`" file appears under a section named "`Changed but not staged for commit`" – which means that a file that is tracked has been modified in the working directory but not yet staged.
107
+
To stage it, you run the `git add` command. `git add` is a multipurpose command – you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. It may be helpful to think of it more as "`add this content to the next commit`" rather than "`add this file to the project`".(((git commands, add)))
108
+
Let’s run `git add` now to stage the "`benchmarks.rb`" file, and then run `git status` again:
109
109
110
110
[source,shell]
111
111
----
@@ -194,7 +194,7 @@ $ cat .gitignore
194
194
*~
195
195
----
196
196
197
-
The first line tells Git to ignore any files ending in ``.o'' or ``.a'' – object and archive files that may be the product of building your code.
197
+
The first line tells Git to ignore any files ending in "`.o`" or "`.a`" – object and archive files that may be the product of building your code.
198
198
The second line tells Git to ignore all files that end with a tilde (`~`), which is used by many text editors such as Emacs to mark temporary files.
199
199
You may also include a log, tmp, or pid directory; automatically generated documentation; and so on.
200
200
Setting up a `.gitignore` file before you get going is generally a good idea so you don’t accidentally commit files that you really don’t want in your Git repository.
@@ -437,15 +437,15 @@ $ git commit -a -m 'added new benchmarks'
437
437
1 file changed, 5 insertions(+), 0 deletions(-)
438
438
----
439
439
440
-
Notice how you don’t have to run `git add` on the ``benchmarks.rb'' file in this case before you commit.
440
+
Notice how you don’t have to run `git add` on the "`benchmarks.rb`" file in this case before you commit.
441
441
442
442
==== Removing Files
443
443
444
444
(((files, removing)))
445
445
To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit.
446
446
The `git rm` command does that, and also removes the file from your working directory so you don’t see it as an untracked file the next time around.
447
447
448
-
If you simply remove the file from your working directory, it shows up under the ``Changed but not updated'' (that is, _unstaged_) area of your `git status` output:
448
+
If you simply remove the file from your working directory, it shows up under the "`Changed but not updated`" (that is, _unstaged_) area of your `git status` output:
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/remotes.asc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ $ git fetch [remote-name]
107
107
The command goes out to that remote project and pulls down all the data from that remote project that you don’t have yet.
108
108
After you do this, you should have references to all the branches from that remote, which you can merge in or inspect at any time.
109
109
110
-
If you clone a repository, the command automatically adds that remote repository under the name ``origin''.
110
+
If you clone a repository, the command automatically adds that remote repository under the name "`origin`".
111
111
So, `git fetch origin` fetches any new work that has been pushed to that server since you cloned (or last fetched from) it.
112
112
It’s important to note that the `git fetch` command pulls the data to your local repository – it doesn’t automatically merge it with any of your work or modify what you’re currently working on.
113
113
You have to merge it manually into your work when you’re ready.
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/viewing-history.asc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
After you have created several commits, or if you have cloned a repository with an existing commit history, you’ll probably want to look back to see what has happened.
4
4
The most basic and powerful tool to do this is the `git log` command.
5
5
6
-
These examples use a very simple project called ``simplegit''.
6
+
These examples use a very simple project called "`simplegit`".
7
7
To get the project, run
8
8
9
9
[source,shell]
@@ -218,7 +218,7 @@ Those are only some simple output-formatting options to `git log` – there are
218
218
| `--name-only` | Show the list of files modified after the commit information.
219
219
| `--name-status` | Show the list of files affected with added/modified/deleted information as well.
220
220
| `--abbrev-commit` | Show only the first few characters of the SHA-1 checksum instead of all 40.
221
-
| `--relative-date` | Display the date in a relative format (for example, ``2 weeks ago'') instead of using the full date format.
221
+
| `--relative-date` | Display the date in a relative format (for example, "`2 weeks ago`") instead of using the full date format.
222
222
| `--graph` | Display an ASCII graph of the branch and merge history beside the log output.
223
223
| `--pretty` | Show commits in an alternate format. Options include oneline, short, full, fuller, and format (where you specify your own format).
Copy file name to clipboardExpand all lines: book/03-git-branching/1-git-branching.asc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Nearly every VCS has some form of branching support.
6
6
Branching means you diverge from the main line of development and continue to do work without messing with that main line.
7
7
In many VCS tools, this is a somewhat expensive process, often requiring you to create a new copy of your source code directory, which can take a long time for large projects.
8
8
9
-
Some people refer to Git's branching model as its ``killer feature,'' and it certainly sets Git apart in the VCS community.
9
+
Some people refer to Git's branching model as its "`killer feature,`" and it certainly sets Git apart in the VCS community.
10
10
Why is it so special?
11
11
The way Git branches is incredibly lightweight, making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast.
12
12
Unlike many other VCSs, Git encourages workflows that branch and merge often, even multiple times in a day.
Copy file name to clipboardExpand all lines: book/03-git-branching/sections/basic-branching-and-merging.asc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,9 +103,9 @@ Fast-forward
103
103
1 file changed, 2 insertions(+)
104
104
----
105
105
106
-
You'll notice the phrase ``fast-forward'' in that merge.
106
+
You'll notice the phrase "`fast-forward`" in that merge.
107
107
Because the commit pointed to by the branch you merged in was directly upstream of the commit you're on, Git simply moves the pointer forward.
108
-
To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit's history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together – this is called a ``fast-forward.''
108
+
To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit's history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together – this is called a "`fast-forward.`"
109
109
110
110
Your change is now in the snapshot of the commit pointed to by the `master` branch, and you can deploy the fix.
111
111
@@ -266,7 +266,7 @@ Normal merge conflict for 'index.html':
266
266
Hit return to start merge resolution tool (opendiff):
267
267
----
268
268
269
-
If you want to use a merge tool other than the default (Git chose `opendiff` in this case because the command was run on a Mac), you can see all the supported tools listed at the top after ``one of the following tools.''
269
+
If you want to use a merge tool other than the default (Git chose `opendiff` in this case because the command was run on a Mac), you can see all the supported tools listed at the top after "`one of the following tools.`"
0 commit comments