iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 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 | |
Clemens Hammacher | 19238fc | 2018-12-05 10:47:05 +0000 | [diff] [blame] | 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. |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 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 | |
Clemens Hammacher | 7808a51 | 2018-12-03 17:02:17 +0000 | [diff] [blame] | 37 | --upstream <REF>:: |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 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 | ------- |
iannucci@chromium.org | 2198002 | 2014-04-11 04:51:49 +0000 | [diff] [blame] | 59 | demo:1[] |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 60 | |
iannucci@chromium.org | 2198002 | 2014-04-11 04:51:49 +0000 | [diff] [blame] | 61 | 1. 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.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 63 | |
| 64 | include::_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 | |
| 74 | SEE ALSO |
| 75 | -------- |
| 76 | linkgit:git-rebase-update[1], linkgit:git-reparent-branch[1], |
| 77 | linkgit:git-rename-branch[1], linkgit:git-upstream-diff[1] |
| 78 | |
| 79 | include::_footer.txt[] |
| 80 | |
| 81 | // vim: ft=asciidoc: |