OLD | NEW |
(Empty) | |
| 1 git-new-branch(1) |
| 2 ================= |
| 3 |
| 4 NAME |
| 5 ---- |
| 6 git-new-branch - |
| 7 include::_git-new-branch_desc.helper.txt[] |
| 8 |
| 9 SYNOPSIS |
| 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 |
| 17 DESCRIPTION |
| 18 ----------- |
| 19 |
| 20 Creates a new branch. By default the new branch will track the configured |
| 21 upstream for the repo (defaults to 'origin/master'). If one of the other options |
| 22 is specified, it will track that other ref instead. |
| 23 |
| 24 Conceptually, each branch in your repo represents one 'Change List (CL)'. If you |
| 25 have many independent CLs (i.e. the changes in one do not interact with/depend |
| 26 on the changes in another), then you should create them as new branches tracking |
| 27 the default upstream (i.e. `git new-branch <branch_name>`). If you have features |
| 28 which depend on each other, you should create stacked branches using `git |
| 29 new-branch --upstream_current <branch_name>`. |
| 30 |
| 31 OPTIONS |
| 32 ------- |
| 33 |
| 34 --upstream_current:: |
| 35 Set the tracking (upstream) branch to the currently-checked-out branch. |
| 36 |
| 37 --uptstream <REF>:: |
| 38 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 |
| 48 CONFIGURATION VARIABLES |
| 49 ----------------------- |
| 50 |
| 51 depot-tools.upstream |
| 52 ~~~~~~~~~~~~~~~~~~~~ |
| 53 |
| 54 This configures the default 'upstream' for all new branches. If it is unset, it |
| 55 defaults to 'origin/master'. This is considered to be the 'root' branch. |
| 56 |
| 57 EXAMPLE |
| 58 ------- |
| 59 |
| 60 [subs="specialcharacters,quotes,attributes,callouts"] |
| 61 ---- |
| 62 [white]**$ git map-branches** |
| 63 [red]#origin/master# |
| 64 [green]#cool_feature# |
| 65 [green]#subfeature# |
| 66 [aqua]#frozen_changes *# |
| 67 [white]**$ git new-branch independent_cl** |
| 68 [white]**$ git map-branches** |
| 69 [red]#origin/master# |
| 70 [green]#cool_feature# |
| 71 [green]#subfeature# |
| 72 [green]#frozen_changes# |
| 73 [aqua]#independent_cl *# |
| 74 [white]**$ git new-branch --upstream subfeature nested_cl** |
| 75 [white]**$ git map-branches** |
| 76 [red]#origin/master# |
| 77 [green]#cool_feature# |
| 78 [aqua]#subfeature# <1> |
| 79 [aqua]#nested_cl *# |
| 80 [green]#frozen_changes# |
| 81 [green]#independent_cl# |
| 82 [white]**$ git checkout cool_feature** |
| 83 [white]**$ git new-branch --upstream_current cl_depends_on_cool_feature** |
| 84 [white]**$ git map-branches** |
| 85 [red]#origin/master# |
| 86 [aqua]#cool_feature# |
| 87 [aqua]#cl_depends_on_cool_feature *# |
| 88 [green]#subfeature# |
| 89 [green]#nested_cl# |
| 90 [green]#frozen_changes# |
| 91 [green]#independent_cl# |
| 92 ---- |
| 93 <1> Note that both branches are cyan because they are currently the same |
| 94 'commit' object. See linkgit::git-map-branches[1] for more detail. |
| 95 |
| 96 include::_aliases.txt[] |
| 97 |
| 98 ---- |
| 99 [alias] |
| 100 git nb = new-branch |
| 101 git tb = new-branch --upstream_current <1> |
| 102 ---- |
| 103 <1> mnemonic: tb -> "track branch" |
| 104 |
| 105 |
| 106 SEE ALSO |
| 107 -------- |
| 108 linkgit:git-rebase-update[1], linkgit:git-reparent-branch[1], |
| 109 linkgit:git-rename-branch[1], linkgit:git-upstream-diff[1] |
| 110 |
| 111 include::_footer.txt[] |
| 112 |
| 113 // vim: ft=asciidoc: |
OLD | NEW |