diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go
index d14ba6cbe9..d1f1255db4 100644
--- a/routers/web/repo/branch.go
+++ b/routers/web/repo/branch.go
@@ -427,5 +427,5 @@ func CreateBranch(ctx *context.Context) {
 	}
 
 	ctx.Flash.Success(ctx.Tr("repo.branch.create_success", form.NewBranchName))
-	ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(form.NewBranchName))
+	ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(form.NewBranchName) + "/" + util.PathEscapeSegments(form.CurrentPath))
 }
diff --git a/services/forms/repo_branch_form.go b/services/forms/repo_branch_form.go
index f9262aaede..011926092f 100644
--- a/services/forms/repo_branch_form.go
+++ b/services/forms/repo_branch_form.go
@@ -16,6 +16,7 @@ import (
 // NewBranchForm form for creating a new branch
 type NewBranchForm struct {
 	NewBranchName string `binding:"Required;MaxSize(100);GitRefName"`
+	CurrentPath   string
 	CreateTag     bool
 }
 
diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl
index 9d1ec10d3c..2010fe261e 100644
--- a/templates/repo/branch_dropdown.tmpl
+++ b/templates/repo/branch_dropdown.tmpl
@@ -94,6 +94,9 @@
 						{{.root.CsrfTokenHtml}}
 						<input type="hidden" name="new_branch_name" v-model="searchTerm">
 						<input type="hidden" name="create_tag" v-model="createTag">
+						{{if $.root.TreePath}}
+							<input type="hidden" name="current_path" value="{{.root.TreePath}}">
+						{{end}}
 					</form>
 				</div>
 			</div>