Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 86fa761

Browse files
committed
package documentation
1 parent aab1853 commit 86fa761

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

blame.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Package blame contains blaming functionality for files in the repo.
2-
//
3-
// Blaming a file is finding what commit was the last to modify each of
4-
// the lines in the file, therefore the output of a blaming operation is
5-
// usualy a slice of commits, one commit per line in the file.
6-
//
7-
// This package also provides a pretty print function to output the
8-
// results of a blame in a similar format to the git-blame command.
91
package git
102

113
import (

doc.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,31 @@
44
//
55
// We have been following the open/close principle in its design to facilitate
66
// extensions.
7+
//
8+
// Small example extracting the commits from a repository:
9+
// func ExampleBasic_printCommits() {
10+
// r, err := git.NewRepository("https://github.com/src-d/go-git", nil)
11+
// if err != nil {
12+
// panic(err)
13+
// }
14+
//
15+
// if err := r.Pull("origin", "refs/heads/master"); err != nil {
16+
// panic(err)
17+
// }
18+
//
19+
// iter := r.Commits()
20+
// defer iter.Close()
21+
//
22+
// for {
23+
// commit, err := iter.Next()
24+
// if err != nil {
25+
// if err == io.EOF {
26+
// break
27+
// }
28+
//
29+
// panic(err)
30+
// }
31+
//
32+
// fmt.Println(commit)
33+
// }
734
package git

0 commit comments

Comments
 (0)