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: en/book/10-git-in-other-environments/chapter10.asc
+35-11Lines changed: 35 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,10 @@ This is the tool to use when you're trying to find something that happened in th
27
27
Gitk is easiest to invoke from the command-line.
28
28
Just `cd` into a Git repository, and type:
29
29
30
-
-----
30
+
[source,shell]
31
+
----
31
32
$ gitk [git log options]
32
-
-----
33
+
----
33
34
34
35
Gitk accepts many command-line options, most of which are passed through to the underlying `git log` action.
35
36
Probably one of the most useful is the `--all` flag, which tells gitk to show commits reachable from _any_ ref, not just HEAD.
@@ -39,14 +40,15 @@ Gitk's interface looks like <<gitk>>.
39
40
.The `gitk` history viewer.
40
41
image::images/gitk.png[The `gitk` history viewer.]
41
42
42
-
On the top is something that looks a bit like the output of `git log --graph`; each dot represents a commit, and the graph is decorated with refs.
43
+
On the top is something that looks a bit like the output of `git log --graph`; each dot represents a commit, the lines represent parent relationships, and refs are shown as colored boxes.
43
44
The yellow dot represents HEAD, and the red dot represents changes that are yet to become a commit.
44
45
At the bottom is a view of the selected commit; the comments and patch on the left, and a summary view on the right.
45
46
In between is a collection of controls used for searching history.
46
47
47
48
`git-gui`, on the other hand, is primarily a tool for crafting commits.
48
49
It, too, is easiest to invoke from the command line:
49
50
51
+
[source,shell]
50
52
-----
51
53
$ git gui
52
54
-----
@@ -69,11 +71,9 @@ Then you can simply stage or unstage some changes, alter the commit message, and
69
71
70
72
+gitk+ and +git-gui+ are examples of task-oriented tools.
71
73
Each of them is tailored for a specific purpose (viewing history and creating commits, respectively), and omit the features not necessary for that task.
72
-
There are several other graphical tools in this category, such as TODO.
73
-
74
-
==== GitHub Desktop
75
74
76
75
76
+
==== GitHub Desktop
77
77
78
78
[[github_win]]
79
79
.GitHub for Windows.
@@ -202,11 +202,19 @@ Libgit2 is a dependency-free implementation of Git, with a focus on having a nic
202
202
203
203
Here's what it looks like to read HEAD's commit message with Libgit2:
204
204
205
+
[source,c]
205
206
-----
206
-
// TODO
207
+
git_repository *repo;
208
+
int error = git_repository_open(&repo, "/path/to/repository");
Of course, it isn't very probably that you'll want to write C when using Libgit2.
217
+
Of course, it isn't very probable that you'll want to write C when using Libgit2.
210
218
Fortunately, there are a number of language-specific bindings available that make it fairly easy to work with Git repositories from your specific language and environment.
211
219
212
220
===== LibGit2Sharp
@@ -215,8 +223,9 @@ If you're writing a .NET or Mono application, LibGit2Sharp (http://libgit2sharp.
215
223
The bindings are written in C#, and great care has been taken to wrap the raw Libgit2 calls with native-feeling CLR APIs.
216
224
Here's what it looks like to read HEAD's commit message:
217
225
226
+
[source,csharp]
218
227
-----
219
-
// TODO
228
+
new Repository(@"C:\path\to\repo").Head.Tip.Message;
220
229
-----
221
230
222
231
For desktop Windows applications, there's a NuGet package that will help you get started quickly.
@@ -228,17 +237,32 @@ If your application is running on an Apple platform, you're likely using Objecti
228
237
Objective-Git (TODO: URL) is the name of the Libgit2 bindings for that environment.
229
238
Again, here's how to read HEAD's commit message:
230
239
240
+
[source,objc]
231
241
-----
232
242
// TODO
233
243
-----
234
244
235
245
===== rugged
236
246
237
-
For Ruby programs, Rugged (TODO: URL) is the library to use.
247
+
For Ruby programs, Rugged (https://github.com/libgit2/rugged[]) is the library to use.
248
+
Once again, HEAD's commit message:
249
+
250
+
[source,ruby]
251
+
----
252
+
# TODO
253
+
----
254
+
238
255
239
256
===== pygit2
240
257
241
-
The bindings for Libgit2 in Python are called Pygit2, and can be found at (TODO: URL).
258
+
The bindings for Libgit2 in Python are called Pygit2, and can be found at http://www.pygit2.org/[].
0 commit comments