'\" t
. \" Title: git-new-branch
. \" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
. \" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
. \" Date: 08/10/2020
. \" Manual: Chromium depot_tools Manual
. \" Source: depot_tools 8c3f7227
. \" Language: English
. \"
.TH "GIT\-NEW\-BRANCH" "1" "08/10/2020" "depot_tools 8c3f7227" "Chromium depot_tools Manual"
. \" -----------------------------------------------------------------
. \" * Define some portability stuff
. \" -----------------------------------------------------------------
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. \" http://bugs.debian.org/507673
. \" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n (.g .ds Aq \(aq
.el .ds Aq '
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
.SH "NAME"
git-new-branch \- Create a new branch with correct tracking information\& .
.SH "SYNOPSIS"
.sp
.nf
\fI git new\- branch\fR <branch_name>
\fI git new\- branch\fR \- \- upstream_current <branch_name>
\fI git new\- branch\fR \- \- upstream <REF> <branch_name>
\fI git new\- branch\fR \- \- lkgr <branch_name>
.fi
.sp
.SH "DESCRIPTION"
.sp
Creates a new branch\& . By default the new branch will track the configured upstream for the repo (defaults to \fI origin/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 \fI Change 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 <branch_name>)\& . If you have features which depend on each other, you should create stacked branches using git new\- branch \- \- upstream_current <branch_name>\& .
.SH "OPTIONS"
.PP
\- \- upstream_current
.RS 4
Set the tracking (upstream) branch to the currently\- checked\- out branch\& .
.RE
.PP
\- \- upstream <REF>
.RS 4
Set the tracking (upstream) branch to <REF>\& . <REF> may be a local branch, remote branch, or a tag\& .
.RE
.PP
\- \- lkgr
.RS 4
Alias for
\- \- upstream lkgr\& .
.RE
.PP
<branch_name>
.RS 4
The name for the new branch\& .
.RE
.SH "CONFIGURATION VARIABLES"
.SS "depot\-tools\&.upstream"
.sp
This configures the default \fI upstream\fR for all new branches\& . If it is unset, it defaults to \fI origin\fR \* (Aqs default branch or \fI origin/master\fR if that can\(cq t be found\& . This is considered to be the \fI root\fR branch\& .
.SH "EXAMPLE"
.sp
.sp
.if n \{ \
.RS 4
. \}
.nf
\fB $ git map\- branches \- v\fR
origin/master
cool_feature [ ahead 4 ]
subfeature [ ahead 2 | behind 1 ]
fixit [ ahead 2 ]
\fB frozen_branch * [ ahead 3 ]
$ git new\- branch independent_cl\fR
\fB $ git map\- branches \- v\fR
\fB origin/master
\fR cool_feature [ ahead 4 ]
subfeature [ ahead 2 | behind 1 ]
fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
\fB independent_cl *
$ vi foo && git add \- A && git commit \- m foo\fR
\fB $ git map\- branches \- v\fR
origin/master
cool_feature [ ahead 4 ]
subfeature [ ahead 2 | behind 1 ]
fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
\fB independent_cl * [ ahead 1 ]
$ git new\- branch \- \- upstream subfeature nested_cl\fR
\fB $ git map\- branches \- v\fR
origin/master
cool_feature [ ahead 4 ]
\fB subfeature [ ahead 2 | behind 1 ] \fR \fB \fB (1)\fR \fR \fB
nested_cl *
\fR fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
independent_cl [ ahead 1 ]
\fB $ git checkout cool_feature\fR
Switched to branch \* (Aqcool_feature\* (Aq
Your branch is ahead of \* (Aqorigin/master\* (Aq by 4 commits\& .
(use "git push" to publish your local commits)
\fB $ git new\- branch \- \- upstream_current cl_depends_on_cool_feature\fR
\fB $ git map\- branches \- v\fR
origin/master
\fB cool_feature [ ahead 4 ]
cl_depends_on_cool_feature *
\fR subfeature [ ahead 2 | behind 1 ]
nested_cl
fixit [ ahead 2 ]
frozen_branch [ ahead 3 ]
independent_cl [ ahead 1 ]
.fi
.if n \{ \
.RE
. \}
.sp
.sp
.RS 4
.ie n \{ \
\h '-04' 1.\h '+01'\c
. \}
.el \{ \
.sp -1
.IP " 1." 4 .2
. \}
Note that both branches are cyan because they are currently the same
\fI commit\fR
object\& . See
\fB git-map-branches\fR (1)
for more detail\& .
.RE
.SH "SUGGESTED ALIASES"
.sp
Some common short\- hand aliases\& . Feel free to add these to your \fI ~/\& .gitconfig\fR file\& .
.sp
.if n \{ \
.RS 4
. \}
.nf
[alias]
git nb = new\- branch
git tb = new\- branch \- \- upstream_current \fB (1)\fR
.fi
.if n \{ \
.RE
. \}
.sp
.sp
\fB 1. \fR mnemonic: tb \(-> "track branch"
.br
.SH "SEE ALSO"
.sp
\fB git-rebase-update\fR (1), \fB git-reparent-branch\fR (1), \fB git-rename-branch\fR (1), \fB git-upstream-diff\fR (1)
.SH "CHROMIUM DEPOT_TOOLS"
.sp
Part of the chromium \fB depot_tools\fR (7) suite\& . These tools are meant to assist with the development of chromium and related projects\& . Download the tools by checking out the \m[blue]\fBgit repository\fR\m[]\&\s-2\u[1] \d \s +2\& .
.SH "NOTES"
.IP " 1." 4
git repository
.RS 4
\% https://chromium.googlesource.com/chromium/tools/depot_tools.git
.RE