aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--example_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/example_test.go b/example_test.go
index 27ea4a2..7b6adc5 100644
--- a/example_test.go
+++ b/example_test.go
@@ -137,6 +137,21 @@ func ExampleRepository_References() {
}
+func ExampleRepository_Branches() {
+ r, _ := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
+ URL: "https://github.com/git-fixtures/basic.git",
+ })
+
+ branches, _ := r.Branches()
+ branches.ForEach(func(branch *plumbing.Reference) error {
+ fmt.Println(branch.Hash().String(), branch.Name())
+ return nil
+ })
+
+ // Example Output:
+ // 6ecf0ef2c2dffb796033e5a02219af86ec6584e5 refs/heads/master
+}
+
func ExampleRepository_CreateRemote() {
r, _ := git.Init(memory.NewStorage(), nil)