git-new-branch.1 4.79 KB
Newer Older
1 2 3 4
'\" t
.\"     Title: git-new-branch
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
5
.\"      Date: 12/15/2016
6
.\"    Manual: Chromium depot_tools Manual
7
.\"    Source: depot_tools f72f1ad
8 9
.\"  Language: English
.\"
10
.TH "GIT\-NEW\-BRANCH" "1" "12/15/2016" "depot_tools f72f1ad" "Chromium depot_tools Manual"
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
.\" -----------------------------------------------------------------
.\" * 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
\fIgit new\-branch\fR <branch_name>
\fIgit new\-branch\fR \-\-upstream_current <branch_name>
\fIgit new\-branch\fR \-\-upstream <REF> <branch_name>
\fIgit 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 \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 <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
\-\-uptstream <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 \fIupstream\fR for all new branches\&. If it is unset, it defaults to \fIorigin/master\fR\&. This is considered to be the \fIroot\fR branch\&.
.SH "EXAMPLE"
73 74
.sp

75 76 77 78 79 80 81 82 83
.sp
.if n \{\
.RS 4
.\}
.nf
\fB$ git map\-branches\fR
origin/master
  cool_feature
    subfeature
84 85 86
  fixit
\fB    frozen_branch *
$ git new\-branch independent_cl\fR
87
\fB$ git map\-branches\fR
88 89
\fBorigin/master
\fR  cool_feature
90
    subfeature
91 92 93 94
  fixit
    frozen_branch
\fB  independent_cl *
$ git new\-branch \-\-upstream subfeature nested_cl\fR
95 96 97
\fB$ git map\-branches\fR
origin/master
  cool_feature
98
\fB    subfeature  \fR\fB\fB(1)\fR\fR\fB
99
      nested_cl *
100 101
\fR  fixit
    frozen_branch
102 103
  independent_cl
\fB$ git checkout cool_feature\fR
104
Switched to branch \*(Aqcool_feature\*(Aq
105 106
Your branch is ahead of \*(Aqorigin/master\*(Aq by 4 commits\&.
  (use "git push" to publish your local commits)
107 108 109
\fB$ git new\-branch \-\-upstream_current cl_depends_on_cool_feature\fR
\fB$ git map\-branches\fR
origin/master
110
\fB  cool_feature
111
    cl_depends_on_cool_feature *
112
\fR    subfeature
113
      nested_cl
114 115
  fixit
    frozen_branch
116 117 118 119 120 121
  independent_cl
.fi
.if n \{\
.RE
.\}
.sp
122

123
.sp
124 125 126 127 128 129 130 131 132
.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
133 134
\fIcommit\fR
object\&. See
135
\fBgit-map-branches\fR(1)
136
for more detail\&.
137
.RE
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
.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
\fB1. \fRmnemonic: tb \(-> "track branch"
.br
.SH "SEE ALSO"
.sp
\fBgit-rebase-update\fR(1), \fBgit-reparent-branch\fR(1), \fBgit-rename-branch\fR(1), \fBgit-upstream-diff\fR(1)
.SH "CHROMIUM DEPOT_TOOLS"
.sp
162
Part of the chromium \fBdepot_tools\fR(7) suite\&. These tools are meant to assist with the development of chromium and related projects\&. Download the tools from \m[blue]\fBhere\fR\m[]\&\s-2\u[1]\d\s+2\&.
163 164 165 166
.SH "NOTES"
.IP " 1." 4
here
.RS 4
167
\%https://chromium.googlesource.com/chromium/tools/depot_tools.git
168
.RE