Skip to content

Commit c00e04c

Browse files
committed
Urls and a bit of code
1 parent c991824 commit c00e04c

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

en/book/10-git-in-other-environments/chapter10.asc

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ This is the tool to use when you're trying to find something that happened in th
2727
Gitk is easiest to invoke from the command-line.
2828
Just `cd` into a Git repository, and type:
2929

30-
-----
30+
[source,shell]
31+
----
3132
$ gitk [git log options]
32-
-----
33+
----
3334

3435
Gitk accepts many command-line options, most of which are passed through to the underlying `git log` action.
3536
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>>.
3940
.The `gitk` history viewer.
4041
image::images/gitk.png[The `gitk` history viewer.]
4142

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.
4344
The yellow dot represents HEAD, and the red dot represents changes that are yet to become a commit.
4445
At the bottom is a view of the selected commit; the comments and patch on the left, and a summary view on the right.
4546
In between is a collection of controls used for searching history.
4647

4748
`git-gui`, on the other hand, is primarily a tool for crafting commits.
4849
It, too, is easiest to invoke from the command line:
4950

51+
[source,shell]
5052
-----
5153
$ git gui
5254
-----
@@ -69,11 +71,9 @@ Then you can simply stage or unstage some changes, alter the commit message, and
6971

7072
+gitk+ and +git-gui+ are examples of task-oriented tools.
7173
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
7574

7675

76+
==== GitHub Desktop
7777

7878
[[github_win]]
7979
.GitHub for Windows.
@@ -202,11 +202,19 @@ Libgit2 is a dependency-free implementation of Git, with a focus on having a nic
202202

203203
Here's what it looks like to read HEAD's commit message with Libgit2:
204204

205+
[source,c]
205206
-----
206-
// TODO
207+
git_repository *repo;
208+
int error = git_repository_open(&repo, "/path/to/repository");
209+
210+
git_object *head_commit;
211+
error = git_revparse_single(&head_commit, repo, "HEAD^{commit}");
212+
213+
git_commit *commit = (git_commit*)head_commit;
214+
printf("%s", git_commit_message);
207215
-----
208216

209-
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.
210218
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.
211219

212220
===== LibGit2Sharp
@@ -215,8 +223,9 @@ If you're writing a .NET or Mono application, LibGit2Sharp (http://libgit2sharp.
215223
The bindings are written in C#, and great care has been taken to wrap the raw Libgit2 calls with native-feeling CLR APIs.
216224
Here's what it looks like to read HEAD's commit message:
217225

226+
[source,csharp]
218227
-----
219-
// TODO
228+
new Repository(@"C:\path\to\repo").Head.Tip.Message;
220229
-----
221230

222231
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
228237
Objective-Git (TODO: URL) is the name of the Libgit2 bindings for that environment.
229238
Again, here's how to read HEAD's commit message:
230239

240+
[source,objc]
231241
-----
232242
// TODO
233243
-----
234244

235245
===== rugged
236246

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+
238255

239256
===== pygit2
240257

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/[].
259+
As always, HEAD's commit message:
260+
261+
[source,python]
262+
----
263+
# TODO
264+
----
265+
242266

243267
===== Others
244268

0 commit comments

Comments
 (0)