This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-8
lines changed Expand file tree Collapse file tree 2 files changed +27
-8
lines changed Original file line number Diff line number Diff line change 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.
91package git
102
113import (
Original file line number Diff line number Diff line change 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+ // }
734package git
You can’t perform that action at this time.
0 commit comments