blob: 6d9bc7211887d6164af6df6e8f599ee80e67e82d [file] [log] [blame]
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +00001git-new-branch(1)
2=================
3
4NAME
5----
6git-new-branch -
7include::_git-new-branch_desc.helper.txt[]
8
9SYNOPSIS
10--------
11[verse]
12'git new-branch' <branch_name>
13'git new-branch' --upstream_current <branch_name>
14'git new-branch' --upstream <REF> <branch_name>
15'git new-branch' --lkgr <branch_name>
16
17DESCRIPTION
18-----------
19
Clemens Hammacher19238fc2018-12-05 10:47:05 +000020Creates a new branch. By default the new branch will track the configured
21upstream for the repo (defaults to 'origin/master'). If one of the other options
22is specified, it will track that other ref instead.
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000023
24Conceptually, each branch in your repo represents one 'Change List (CL)'. If you
25have many independent CLs (i.e. the changes in one do not interact with/depend
26on the changes in another), then you should create them as new branches tracking
27the default upstream (i.e. `git new-branch <branch_name>`). If you have features
28which depend on each other, you should create stacked branches using `git
29new-branch --upstream_current <branch_name>`.
30
31OPTIONS
32-------
33
34--upstream_current::
35 Set the tracking (upstream) branch to the currently-checked-out branch.
36
Clemens Hammacher7808a512018-12-03 17:02:17 +000037--upstream <REF>::
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000038 Set the tracking (upstream) branch to <REF>. <REF> may be a local branch,
39 remote branch, or a tag.
40
41--lkgr::
42 Alias for `--upstream lkgr`.
43
44<branch_name>::
45 The name for the new branch.
46
47
48CONFIGURATION VARIABLES
49-----------------------
50
51depot-tools.upstream
52~~~~~~~~~~~~~~~~~~~~
53
54This configures the default 'upstream' for all new branches. If it is unset, it
55defaults to 'origin/master'. This is considered to be the 'root' branch.
56
57EXAMPLE
58-------
iannucci@chromium.org21980022014-04-11 04:51:49 +000059demo:1[]
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000060
iannucci@chromium.org21980022014-04-11 04:51:49 +0000611. Note that both branches are cyan because they are currently the same
62'commit' object. See linkgit:git-map-branches[1] for more detail.
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000063
64include::_aliases.txt[]
65
66----
67[alias]
68 git nb = new-branch
69 git tb = new-branch --upstream_current <1>
70----
71<1> mnemonic: tb -> "track branch"
72
73
74SEE ALSO
75--------
76linkgit:git-rebase-update[1], linkgit:git-reparent-branch[1],
77linkgit:git-rename-branch[1], linkgit:git-upstream-diff[1]
78
79include::_footer.txt[]
80
81// vim: ft=asciidoc: