diff --git a/git_new_branch.py b/git_new_branch.py index 105da17d00..d61a42d790 100755 --- a/git_new_branch.py +++ b/git_new_branch.py @@ -58,8 +58,7 @@ def main(args): else: # TODO(iannucci): Detect unclean workdir then stash+pop if we need to # teleport to a conflicting portion of history? - run('checkout', '-b', opts.branch_name) - run('branch', '--set-upstream-to', opts.upstream) + run('checkout', '--track', opts.upstream, '-b', opts.branch_name) get_or_create_merge_base(opts.branch_name) except subprocess2.CalledProcessError as cpe: sys.stdout.write(cpe.stdout) diff --git a/man/html/git-new-branch.html b/man/html/git-new-branch.html index d4c645695b..4f11776820 100644 --- a/man/html/git-new-branch.html +++ b/man/html/git-new-branch.html @@ -766,9 +766,9 @@ git-new-branch(1) Manual Page

DESCRIPTION

-

Creates a new branch for HEAD. By default the new branch will track the -configured upstream for the repo (defaults to origin/master). If one of the -other options is specified, it will track that other ref instead.

+

Creates a new branch. By default the new branch will track the configured +upstream for the repo (defaults to origin/master). If one of the other options +is specified, it will track that other ref instead.

Conceptually, each branch in your repo represents one Change List (CL). If you have many independent CLs (i.e. the changes in one do not interact with/depend on the changes in another), then you should create them as new branches tracking @@ -917,7 +917,7 @@ from


diff --git a/man/man1/git-new-branch.1 b/man/man1/git-new-branch.1 index 5d528f2031..14d50601ab 100644 --- a/man/man1/git-new-branch.1 +++ b/man/man1/git-new-branch.1 @@ -1,8 +1,8 @@ '\" t .\" Title: git-new-branch .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 11/26/2018 +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 12/15/2016 .\" Manual: Chromium depot_tools Manual .\" Source: depot_tools f72f1ad .\" Language: English @@ -40,7 +40,7 @@ git-new-branch \- Create a new branch with correct tracking information\&. .sp .SH "DESCRIPTION" .sp -Creates a new branch for \fBHEAD\fR\&. By default the new branch will track the configured upstream for the repo (defaults to \fIorigin/master\fR)\&. If one of the other options is specified, it will track that other ref instead\&. +Creates a new branch\&. By default the new branch will track the configured upstream for the repo (defaults to \fIorigin/master\fR)\&. If one of the other options is specified, it will track that other ref instead\&. .sp Conceptually, each branch in your repo represents one \fIChange List (CL)\fR\&. If you have many independent CLs (i\&.e\&. the changes in one do not interact with/depend on the changes in another), then you should create them as new branches tracking the default upstream (i\&.e\&. git new\-branch )\&. If you have features which depend on each other, you should create stacked branches using git new\-branch \-\-upstream_current \&. .SH "OPTIONS" diff --git a/man/src/git-new-branch.txt b/man/src/git-new-branch.txt index 694fe9c21d..6d9bc72118 100644 --- a/man/src/git-new-branch.txt +++ b/man/src/git-new-branch.txt @@ -17,9 +17,9 @@ SYNOPSIS DESCRIPTION ----------- -Creates a new branch for *HEAD*. By default the new branch will track the -configured upstream for the repo (defaults to 'origin/master'). If one of the -other options is specified, it will track that other ref instead. +Creates a new branch. By default the new branch will track the configured +upstream for the repo (defaults to 'origin/master'). If one of the other options +is specified, it will track that other ref instead. Conceptually, each branch in your repo represents one 'Change List (CL)'. If you have many independent CLs (i.e. the changes in one do not interact with/depend diff --git a/tests/git_rebase_update_test.py b/tests/git_rebase_update_test.py index 22d71022ce..e8d7d5f902 100755 --- a/tests/git_rebase_update_test.py +++ b/tests/git_rebase_update_test.py @@ -69,7 +69,7 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase): super(GitRebaseUpdateTest, self).tearDown() def testRebaseUpdate(self): - self.repo.git('checkout', 'origin/master') + self.repo.git('checkout', 'branch_K') self.repo.run(self.nb.main, ['foobar']) self.assertEqual(self.repo.git('rev-parse', 'HEAD').stdout,