aboutsummaryrefslogtreecommitdiffstats
path: root/doc.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-02-16 17:21:00 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-02-16 17:21:00 +0100
commit86fa7617efcfb468837f58c9b530c4ef7cbcb460 (patch)
treef88b94436c3cab8fe9cf09ce2a07a8ecf3338ae3 /doc.go
parentaab1853ef013f54e8ad5074ecb0e64f31c61d2c7 (diff)
downloadgo-git-86fa7617efcfb468837f58c9b530c4ef7cbcb460.tar.gz
package documentation
Diffstat (limited to 'doc.go')
-rw-r--r--doc.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc.go b/doc.go
index a37a12d..d6b3cf5 100644
--- a/doc.go
+++ b/doc.go
@@ -4,4 +4,31 @@
//
// We have been following the open/close principle in its design to facilitate
// extensions.
+//
+// Small example extracting the commits from a repository:
+// func ExampleBasic_printCommits() {
+// r, err := git.NewRepository("https://github.com/src-d/go-git", nil)
+// if err != nil {
+// panic(err)
+// }
+//
+// if err := r.Pull("origin", "refs/heads/master"); err != nil {
+// panic(err)
+// }
+//
+// iter := r.Commits()
+// defer iter.Close()
+//
+// for {
+// commit, err := iter.Next()
+// if err != nil {
+// if err == io.EOF {
+// break
+// }
+//
+// panic(err)
+// }
+//
+// fmt.Println(commit)
+// }
package git