Add example for pulling changes
diff --git a/_examples/README.md b/_examples/README.md
index 2e7d514..8df7966 100644
--- a/_examples/README.md
+++ b/_examples/README.md
@@ -12,6 +12,7 @@
 - [push](push/main.go) - Push repository to default remote (origin)
 - [checkout](checkout/main.go) - check out a specific commit from a repository
 - [tag](tag/main.go) - list/print repository tags
+- [pull](pull/main.go) - pull changes from a remote repository
 ### Advanced
 - [custom_http](custom_http/main.go) - Replacing the HTTP client using a custom one
 - [storage](storage/README.md) - Implementing a custom storage system
diff --git a/_examples/common_test.go b/_examples/common_test.go
index 86205fe..955e83e 100644
--- a/_examples/common_test.go
+++ b/_examples/common_test.go
@@ -24,6 +24,7 @@
 	"push":        []string{setEmptyRemote(cloneRepository(defaultURL, tempFolder()))},
 	"showcase":    []string{defaultURL, tempFolder()},
 	"tag":         []string{cloneRepository(defaultURL, tempFolder())},
+	"pull":        []string{createRepositoryWithRemote(tempFolder(), defaultURL)},
 }
 
 var ignored = map[string]bool{}
@@ -88,13 +89,28 @@
 }
 
 func createBareRepository(dir string) string {
-	cmd := exec.Command("git", "init", "--bare", dir)
+	return createRepository(dir, true)
+}
+
+func createRepository(dir string, isBare bool) string {
+	var cmd *exec.Cmd
+	if isBare {
+		cmd = exec.Command("git", "init", "--bare", dir)
+	} else {
+		cmd = exec.Command("git", "init", dir)
+	}
 	err := cmd.Run()
 	CheckIfError(err)
 
 	return dir
 }
 
+func createRepositoryWithRemote(local, remote string) string {
+	createRepository(local, false)
+	addRemote(local, remote)
+	return local
+}
+
 func setEmptyRemote(dir string) string {
 	remote := createBareRepository(tempFolder())
 	setRemote(dir, remote)
@@ -108,6 +124,13 @@
 	CheckIfError(err)
 }
 
+func addRemote(local, remote string) {
+	cmd := exec.Command("git", "remote", "add", "origin", remote)
+	cmd.Dir = local
+	err := cmd.Run()
+	CheckIfError(err)
+}
+
 func testExample(t *testing.T, name, example string) {
 	cmd := exec.Command("go", append([]string{
 		"run", filepath.Join(example),
diff --git a/_examples/pull/main.go b/_examples/pull/main.go
new file mode 100644
index 0000000..ae751d2
--- /dev/null
+++ b/_examples/pull/main.go
@@ -0,0 +1,36 @@
+package main
+
+import (
+	"fmt"
+	"os"
+
+	"gopkg.in/src-d/go-git.v4"
+	. "gopkg.in/src-d/go-git.v4/_examples"
+)
+
+// Pull changes from a remote repository
+func main() {
+	CheckArgs("<path>")
+	path := os.Args[1]
+
+	// We instance a new repository targeting the given path (the .git folder)
+	r, err := git.PlainOpen(path)
+	CheckIfError(err)
+
+	// Get the working directory for the repository
+	w, err := r.Worktree()
+	CheckIfError(err)
+
+	// Pull the latest changes from the origin remote and merge into the current branch
+	Info("git pull origin")
+	err = w.Pull(&git.PullOptions{RemoteName: "origin"})
+	CheckIfError(err)
+
+	// Print the latest commit that was just pulled
+	ref, err := r.Head()
+	CheckIfError(err)
+	commit, err := r.CommitObject(ref.Hash())
+	CheckIfError(err)
+
+	fmt.Println(commit)
+}