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/03-git-branching/sections/rebasing.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
@@ -181,7 +181,7 @@ It's pretty safe to assume that the other developer doesn't want `C4` and `C6` t
181
181
182
182
If you *do* find yourself in a situation like this, Git has some further magic that might help you out. If someone on your team force pushes changes that overwrite work that you've based work on, your challenge is to figure out what is yours and what they've rewritten.
183
183
184
-
It turns out that in addition to the commit SHA checksum, Git also calculates a checksum that is based just on the patch introduced with the commit. This is called a ``patch-id''.
184
+
It turns out that in addition to the commit SHA-1 checksum, Git also calculates a checksum that is based just on the patch introduced with the commit. This is called a ``patch-id''.
185
185
186
186
If you pull down work that was rewritten and rebase it on top of the new commits from your partner, Git can often successfully figure out what is uniquely yours and apply them back on top of the new branch.
Copy file name to clipboardExpand all lines: book/06-github/sections/2-contributing.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
@@ -276,7 +276,7 @@ Now if Tony goes back and closes out the original Pull Request, we can see that
276
276
.Cross references rendered in a Pull Request.
277
277
image::images/mentions-03-closed.png[PR closed]
278
278
279
-
In addition to issue numbers, you can also reference a specific commit by SHA. You have to specify a full 40 character SHA, but if GitHub sees that in a comment, it will link directly to the commit. Again, you can reference commits in forks or other repositories in the same way you did with issues.
279
+
In addition to issue numbers, you can also reference a specific commit by SHA-1. You have to specify a full 40 character SHA-1, but if GitHub sees that in a comment, it will link directly to the commit. Again, you can reference commits in forks or other repositories in the same way you did with issues.
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/advanced-merging.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
@@ -156,7 +156,7 @@ $ git show :2:hello.rb > hello.ours.rb
156
156
$ git show :3:hello.rb > hello.theirs.rb
157
157
----
158
158
159
-
If you want to get a little more hard core, you can also use the `ls-files -u` plumbing command to get the actual SHAs of the Git blobs for each of these files.
159
+
If you want to get a little more hard core, you can also use the `ls-files -u` plumbing command to get the actual SHA-1s of the Git blobs for each of these files.
The `:1:hello.rb` is just a shorthand for looking up that blob SHA.
169
+
The `:1:hello.rb` is just a shorthand for looking up that blob SHA-1.
170
170
171
171
Now that we have the content of all three stages in our working directory, we can manually fix up theirs to fix the whitespace issue and re-merge the file with the little-known `git merge-file` command which does just that.
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/debugging.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
@@ -32,7 +32,7 @@ The next two fields are values extracted from that commit–the author name and
32
32
After that come the line number and the content of the file.
33
33
Also note the `^4832fe2` commit lines, which designate that those lines were in this file’s original commit.
34
34
That commit is when this file was first added to this project, and those lines have been unchanged since.
35
-
This is a tad confusing, because now you’ve seen at least three different ways that Git uses the `^` to modify a commit SHA, but that is what it means here.
35
+
This is a tad confusing, because now you’ve seen at least three different ways that Git uses the `^` to modify a commit SHA-1, but that is what it means here.
36
36
37
37
Another cool thing about Git is that it doesn’t track file renames explicitly.
38
38
It records the snapshots and then tries to figure out what was renamed implicitly, after the fact.
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/replace.asc
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ Git's objects are unchangeable, but it does provide an interesting way to preten
5
5
6
6
The `replace` command lets you specify an object in Git and say "every time you see this, pretend it's this other thing". This is most commonly useful for replacing one commit in your history with another one.
7
7
8
-
For example, let's say you have a huge code history and want to split your repository into one short history for new developers and one much longer and larger history for people interested in data mining. You can graft one history onto the other by `replace`ing the earliest commit in the new line with the latest commit on the older one. This is nice because it means that you don't actually have to rewrite every commit in the new history, as you would normally have to do to join them together (because the parentage effects the SHAs).
8
+
For example, let's say you have a huge code history and want to split your repository into one short history for new developers and one much longer and larger history for people interested in data mining. You can graft one history onto the other by `replace`ing the earliest commit in the new line with the latest commit on the older one. This is nice because it means that you don't actually have to rewrite every commit in the new history, as you would normally have to do to join them together (because the parentage effects the SHA-1s).
9
9
10
-
Let's try this out. Let's take an existing repository, split it into two repositories, one recent and one historical, and then we'll see how we can recombine them without modifying the recent repositories SHA values via `replace`.
10
+
Let's try this out. Let's take an existing repository, split it into two repositories, one recent and one historical, and then we'll see how we can recombine them without modifying the recent repositories SHA-1 values via `replace`.
11
11
12
12
We'll use a simple repository with five simple commits:
13
13
@@ -70,7 +70,7 @@ c1822cf first commit
70
70
71
71
It's useful in this case to create a base commit that has instructions on how to expand the history, so other developers know what to do if they hit the first commit in the truncated history and need more. So, what we're going to do is create an initial commit object as our base point with instructions, then rebase the remaining commits (four and five) on top of it.
72
72
73
-
To do that, we need to choose a point to split at, which for us is the third commit, which is `9c68fdc` in SHA-speak. So, our base commit will be based off of that tree. We can create our base commit using the `commit-tree` command, which just takes a tree and will give us a brand new, parentless commit object SHA back.
73
+
To do that, we need to choose a point to split at, which for us is the third commit, which is `9c68fdc` in SHA-speak. So, our base commit will be based off of that tree. We can create our base commit using the `commit-tree` command, which just takes a tree and will give us a brand new, parentless commit object SHA-1 back.
74
74
75
75
[source,console]
76
76
----
@@ -85,7 +85,7 @@ The `commit-tree` command is one of a set of commands that are commonly referred
85
85
86
86
image::images/replace3.png[]
87
87
88
-
OK, so now that we have a base commit, we can rebase the rest of our history on top of that with `git rebase --onto`. The `--onto` argument will be the SHA we just got back from `commit-tree` and the rebase point will be the third commit (the parent of the first commit we want to keep, `9c68fdc`):
88
+
OK, so now that we have a base commit, we can rebase the rest of our history on top of that with `git rebase --onto`. The `--onto` argument will be the SHA-1 we just got back from `commit-tree` and the rebase point will be the third commit (the parent of the first commit we want to keep, `9c68fdc`):
89
89
90
90
[source,console]
91
91
----
@@ -153,11 +153,11 @@ e146b5f fifth commit
153
153
c1822cf first commit
154
154
----
155
155
156
-
Cool, right? Without having to change all the SHAs upstream, we were able to replace one commit in our history with an entirely different commit and all the normal tools (`bisect`, `blame`, etc) will work how we would expect them to.
156
+
Cool, right? Without having to change all the SHA-1s upstream, we were able to replace one commit in our history with an entirely different commit and all the normal tools (`bisect`, `blame`, etc) will work how we would expect them to.
157
157
158
158
image::images/replace5.png[]
159
159
160
-
Interestingly, it still shows `81a708d` as the SHA, even though it's actually using the `c6e1e95` commit data that we replaced it with. Even if you run a command like `cat-file`, it will show you the replaced data:
160
+
Interestingly, it still shows `81a708d` as the SHA-1, even though it's actually using the `c6e1e95` commit data that we replaced it with. Even if you run a command like `cat-file`, it will show you the replaced data:
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/reset.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
@@ -29,7 +29,7 @@ That means HEAD will be the parent of the next commit that is created.
29
29
It's generally simplest to think of HEAD as the snapshot of *your last commit*.
30
30
31
31
In fact, it's pretty easy to see what that snapshot looks like.
32
-
Here is an example of getting the actual directory listing and SHA checksums for each file in the HEAD snapshot:
32
+
Here is an example of getting the actual directory listing and SHA-1 checksums for each file in the HEAD snapshot:
33
33
34
34
[source,console]
35
35
----
@@ -204,7 +204,7 @@ This actually sort of makes sense – HEAD is just a pointer, and you can't poin
204
204
But the Index and Working directory _can_ be partially updated, so reset proceeds with steps 2 and 3.
205
205
206
206
So, assume we run `git reset file.txt`.
207
-
This form (since you did not specify a commit SHA or branch, and you didn't specify `--soft` or `--hard`) is shorthand for `git reset --mixed HEAD file.txt`, which will:
207
+
This form (since you did not specify a commit SHA-1 or branch, and you didn't specify `--soft` or `--hard`) is shorthand for `git reset --mixed HEAD file.txt`, which will:
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/revision-selection.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
@@ -9,7 +9,7 @@ They aren’t necessarily obvious but are helpful to know.
9
9
You can obviously refer to a commit by the SHA-1 hash that it’s given, but there are more human-friendly ways to refer to commits as well.
10
10
This section outlines the various ways you can refer to a single commit.
11
11
12
-
==== Short SHA
12
+
==== Short SHA-1
13
13
14
14
Git is smart enough to figure out what commit you meant to type if you provide the first few characters, as long as your partial SHA-1 is at least four characters long and unambiguous – that is, only one object in the current repository begins with that partial SHA-1.
15
15
@@ -60,7 +60,7 @@ a11bef0 first commit
60
60
61
61
Generally, eight to ten characters are more than enough to be unique within a project.
62
62
63
-
As an example, the Linux kernel, which is a pretty large project with over 450k commits and 3.6 million objects, has no two objects whose SHAs overlap more than the first 11 characters.
63
+
As an example, the Linux kernel, which is a pretty large project with over 450k commits and 3.6 million objects, has no two objects whose SHA-1s overlap more than the first 11 characters.
64
64
65
65
[NOTE]
66
66
.A SHORT NOTE ABOUT SHA-1
@@ -95,7 +95,7 @@ $ git show ca82a6dff817ec66f44342007202690a93763949
95
95
$ git show topic1
96
96
----
97
97
98
-
If you want to see which specific SHA a branch points to, or if you want to see what any of these examples boils down to in terms of SHAs, you can use a Git plumbing tool called `rev-parse`.
98
+
If you want to see which specific SHA-1 a branch points to, or if you want to see what any of these examples boils down to in terms of SHA-1s, you can use a Git plumbing tool called `rev-parse`.
99
99
You can see <<_git_internals>> for more information about plumbing tools; basically, `rev-parse` exists for lower-level operations and isn’t designed to be used in day-to-day operations.
100
100
However, it can be helpful sometimes when you need to see what’s really going on.
Once again, this changes the SHAs of all the commits in your list, so make sure no commit shows up in that list that you’ve already pushed to a shared repository.
261
+
Once again, this changes the SHA-1s of all the commits in your list, so make sure no commit shows up in that list that you’ve already pushed to a shared repository.
This goes through and rewrites every commit to have your new address.
329
-
Because commits contain the SHA-1 values of their parents, this command changes every commit SHA in your history, not just those that have the matching e-mail address.
329
+
Because commits contain the SHA-1 values of their parents, this command changes every commit SHA-1 in your history, not just those that have the matching e-mail address.
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/submodules.asc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -541,7 +541,7 @@ Automatic merge failed; fix conflicts and then commit the result.
541
541
542
542
So basically what has happened here is that Git has figured out that the two branches record points in the submodule's history that are divergent and need to be merged. It explains it as ``merge following commits not found'', which is confusing but we'll explain why that is in a bit.
543
543
544
-
To solve the problem, you need to figure out what state the submodule should be in. Strangely, Git doesn't really give you much information to help out here, not even the SHAs of the commits of both sides of the history. Fortunately, it's simple to figure out. If you run `git diff` you can get the SHAs of the commits recorded in both branches you were trying to merge.
544
+
To solve the problem, you need to figure out what state the submodule should be in. Strangely, Git doesn't really give you much information to help out here, not even the SHA-1s of the commits of both sides of the history. Fortunately, it's simple to figure out. If you run `git diff` you can get the SHA-1s of the commits recorded in both branches you were trying to merge.
545
545
546
546
[source,console]
547
547
----
@@ -554,9 +554,9 @@ index eb41d76,c771610..0000000
554
554
555
555
So, in this case, `eb41d76` is the commit in our submodule that *we* had and `c771610` is the commit that upstream had. If we go into our submodule directory, it should already be on `eb41d76` as the merge would not have touched it. If for whatever reason it's not, you can simply create and checkout a branch pointing to it.
556
556
557
-
What is important is the SHA of the commit from the other side. This is what you'll have to merge in and resolve. You can either just try the merge with the SHA directly, or you can create a branch for it and then try to merge that in. We would suggest the latter, even if only to make a nicer merge commit message.
557
+
What is important is the SHA-1 of the commit from the other side. This is what you'll have to merge in and resolve. You can either just try the merge with the SHA-1 directly, or you can create a branch for it and then try to merge that in. We would suggest the latter, even if only to make a nicer merge commit message.
558
558
559
-
So, we will go into our submodule directory, create a branch based on that second SHA from `git diff` and manually merge.
559
+
So, we will go into our submodule directory, create a branch based on that second SHA-1 from `git diff` and manually merge.
Copy file name to clipboardExpand all lines: book/08-customizing-git/sections/attributes.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
@@ -155,15 +155,15 @@ Git attributes offers you two ways to do this.
155
155
156
156
First, you can inject the SHA-1 checksum of a blob into an `$Id$` field in the file automatically.
157
157
If you set this attribute on a file or set of files, then the next time you check out that branch, Git will replace that field with the SHA-1 of the blob.
158
-
It's important to notice that it isn't the SHA of the commit, but of the blob itself:
158
+
It's important to notice that it isn't the SHA-1 of the commit, but of the blob itself:
159
159
160
160
[source,console]
161
161
----
162
162
$ echo '*.txt ident' >> .gitattributes
163
163
$ echo '$Id$' > test.txt
164
164
----
165
165
166
-
The next time you check out this file, Git injects the SHA of the blob:
166
+
The next time you check out this file, Git injects the SHA-1 of the blob:
If you've used keyword substitution in CVS or Subversion, you can include a datestamp – the SHA isn't all that helpful, because it's fairly random and you can't tell if one SHA is older or newer than another just by looking at them.
177
+
If you've used keyword substitution in CVS or Subversion, you can include a datestamp – the SHA-1 isn't all that helpful, because it's fairly random and you can't tell if one SHA-1 is older or newer than another just by looking at them.
178
178
179
179
It turns out that you can write your own filters for doing substitutions in files on commit/checkout.
180
180
These are called ``clean'' and ``smudge'' filters.
0 commit comments