From 42a3bbb0f426720ac4f95a5ca7832f008156cb82 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 23 Dec 2016 19:36:16 -0500 Subject: Fetch before Checkout when create pull request (#3699) --- models/repo.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'models') diff --git a/models/repo.go b/models/repo.go index 010c9fad..9cbb1872 100644 --- a/models/repo.go +++ b/models/repo.go @@ -482,6 +482,11 @@ func UpdateLocalCopyBranch(repoPath, localPath, branch string) error { return fmt.Errorf("git clone %s: %v", branch, err) } } else { + if err := git.Fetch(localPath, git.FetchRemoteOptions{ + Prune: true, + }); err != nil { + return fmt.Errorf("git fetch: %v", err) + } if err := git.Checkout(localPath, git.CheckoutOptions{ Branch: branch, }); err != nil { -- cgit v1.2.3