git-new-branch.1 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. '\" t
  2. .\" Title: git-new-branch
  3. .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
  5. .\" Date: 05/03/2019
  6. .\" Manual: Chromium depot_tools Manual
  7. .\" Source: depot_tools e58cce6c
  8. .\" Language: English
  9. .\"
  10. .TH "GIT\-NEW\-BRANCH" "1" "05/03/2019" "depot_tools e58cce6c" "Chromium depot_tools Manual"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. git-new-branch \- Create a new branch with correct tracking information\&.
  32. .SH "SYNOPSIS"
  33. .sp
  34. .nf
  35. \fIgit new\-branch\fR <branch_name>
  36. \fIgit new\-branch\fR \-\-upstream_current <branch_name>
  37. \fIgit new\-branch\fR \-\-upstream <REF> <branch_name>
  38. \fIgit new\-branch\fR \-\-lkgr <branch_name>
  39. .fi
  40. .sp
  41. .SH "DESCRIPTION"
  42. .sp
  43. 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\&.
  44. .sp
  45. 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>\&.
  46. .SH "OPTIONS"
  47. .PP
  48. \-\-upstream_current
  49. .RS 4
  50. Set the tracking (upstream) branch to the currently\-checked\-out branch\&.
  51. .RE
  52. .PP
  53. \-\-upstream <REF>
  54. .RS 4
  55. Set the tracking (upstream) branch to <REF>\&. <REF> may be a local branch, remote branch, or a tag\&.
  56. .RE
  57. .PP
  58. \-\-lkgr
  59. .RS 4
  60. Alias for
  61. \-\-upstream lkgr\&.
  62. .RE
  63. .PP
  64. <branch_name>
  65. .RS 4
  66. The name for the new branch\&.
  67. .RE
  68. .SH "CONFIGURATION VARIABLES"
  69. .SS "depot\-tools\&.upstream"
  70. .sp
  71. 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\&.
  72. .SH "EXAMPLE"
  73. .sp
  74. .sp
  75. .if n \{\
  76. .RS 4
  77. .\}
  78. .nf
  79. \fB$ git map\-branches \-v\fR
  80. origin/master
  81. cool_feature [ ahead 4 ]
  82. subfeature [ ahead 2 | behind 1 ]
  83. fixit [ ahead 2 ]
  84. \fB frozen_branch * [ ahead 3 ]
  85. $ git new\-branch independent_cl\fR
  86. \fB$ git map\-branches \-v\fR
  87. \fBorigin/master
  88. \fR cool_feature [ ahead 4 ]
  89. subfeature [ ahead 2 | behind 1 ]
  90. fixit [ ahead 2 ]
  91. frozen_branch [ ahead 3 ]
  92. \fB independent_cl *
  93. $ vi foo && git add \-A && git commit \-m foo\fR
  94. \fB$ git map\-branches \-v\fR
  95. origin/master
  96. cool_feature [ ahead 4 ]
  97. subfeature [ ahead 2 | behind 1 ]
  98. fixit [ ahead 2 ]
  99. frozen_branch [ ahead 3 ]
  100. \fB independent_cl * [ ahead 1 ]
  101. $ git new\-branch \-\-upstream subfeature nested_cl\fR
  102. \fB$ git map\-branches \-v\fR
  103. origin/master
  104. cool_feature [ ahead 4 ]
  105. \fB subfeature [ ahead 2 | behind 1 ] \fR\fB\fB(1)\fR\fR\fB
  106. nested_cl *
  107. \fR fixit [ ahead 2 ]
  108. frozen_branch [ ahead 3 ]
  109. independent_cl [ ahead 1 ]
  110. \fB$ git checkout cool_feature\fR
  111. Switched to branch \*(Aqcool_feature\*(Aq
  112. Your branch is ahead of \*(Aqorigin/master\*(Aq by 4 commits\&.
  113. (use "git push" to publish your local commits)
  114. \fB$ git new\-branch \-\-upstream_current cl_depends_on_cool_feature\fR
  115. \fB$ git map\-branches \-v\fR
  116. origin/master
  117. \fB cool_feature [ ahead 4 ]
  118. cl_depends_on_cool_feature *
  119. \fR subfeature [ ahead 2 | behind 1 ]
  120. nested_cl
  121. fixit [ ahead 2 ]
  122. frozen_branch [ ahead 3 ]
  123. independent_cl [ ahead 1 ]
  124. .fi
  125. .if n \{\
  126. .RE
  127. .\}
  128. .sp
  129. .sp
  130. .RS 4
  131. .ie n \{\
  132. \h'-04' 1.\h'+01'\c
  133. .\}
  134. .el \{\
  135. .sp -1
  136. .IP " 1." 4.2
  137. .\}
  138. Note that both branches are cyan because they are currently the same
  139. \fIcommit\fR
  140. object\&. See
  141. \fBgit-map-branches\fR(1)
  142. for more detail\&.
  143. .RE
  144. .SH "SUGGESTED ALIASES"
  145. .sp
  146. Some common short\-hand aliases\&. Feel free to add these to your \fI~/\&.gitconfig\fR file\&.
  147. .sp
  148. .if n \{\
  149. .RS 4
  150. .\}
  151. .nf
  152. [alias]
  153. git nb = new\-branch
  154. git tb = new\-branch \-\-upstream_current \fB(1)\fR
  155. .fi
  156. .if n \{\
  157. .RE
  158. .\}
  159. .sp
  160. .sp
  161. \fB1. \fRmnemonic: tb \(-> "track branch"
  162. .br
  163. .SH "SEE ALSO"
  164. .sp
  165. \fBgit-rebase-update\fR(1), \fBgit-reparent-branch\fR(1), \fBgit-rename-branch\fR(1), \fBgit-upstream-diff\fR(1)
  166. .SH "CHROMIUM DEPOT_TOOLS"
  167. .sp
  168. 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\&.
  169. .SH "NOTES"
  170. .IP " 1." 4
  171. here
  172. .RS 4
  173. \%https://chromium.googlesource.com/chromium/tools/depot_tools.git
  174. .RE