diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-07-06 15:37:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-07-06 15:37:42 -0700 |
commit | 4d9e42f8f11c57b32b976a943c8ddaf6214e64b8 (patch) | |
tree | f1aee1490288aa30fb62a981696389d9b5e3e992 /Documentation/git-branch.txt | |
parent | checkout: do not write bogus reflog entry out (diff) | |
parent | GIT 1.6.0 (diff) | |
download | tgif-4d9e42f8f11c57b32b976a943c8ddaf6214e64b8.tar.xz |
Merge commit 'v1.6.0' into jc/checkout-reflog-fix
* commit 'v1.6.0': (2063 commits)
GIT 1.6.0
git-p4: chdir now properly sets PWD environment variable in msysGit
Improve error output of git-rebase
t9300: replace '!' with test_must_fail
Git.pm: Make File::Spec and File::Temp requirement lazy
Documentation: document the pager.* configuration setting
git-stash: improve synopsis in help and manual page
Makefile: building git in cygwin 1.7.0
git-am: ignore --binary option
bash-completion: Add non-command git help files to bash-completion
Fix t3700 on filesystems which do not support question marks in names
Utilise our new p4_read_pipe and p4_write_pipe wrappers
Add p4 read_pipe and write_pipe wrappers
bash completion: Add '--merge' long option for 'git log'
bash completion: Add completion for 'git mergetool'
git format-patch documentation: clarify what --cover-letter does
bash completion: 'git apply' should use 'fix' not 'strip'
t5304-prune: adjust file mtime based on system time rather than file mtime
test-parse-options: use appropriate cast in length_callback
Fix escaping of glob special characters in pathspecs
...
Conflicts:
builtin-checkout.c
Diffstat (limited to 'Documentation/git-branch.txt')
-rw-r--r-- | Documentation/git-branch.txt | 94 |
1 files changed, 60 insertions, 34 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index f920c04cc0..6103d62fe3 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -8,22 +8,27 @@ git-branch - List, create, or delete branches SYNOPSIS -------- [verse] -'git-branch' [--color | --no-color] [-r | -a] - [-v [--abbrev=<length> | --no-abbrev]] - [--contains <commit>] -'git-branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>] -'git-branch' (-m | -M) [<oldbranch>] <newbranch> -'git-branch' (-d | -D) [-r] <branchname>... +'git branch' [--color | --no-color] [-r | -a] + [-v [--abbrev=<length> | --no-abbrev]] + [(--merged | --no-merged | --contains) [<commit>]] +'git branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>] +'git branch' (-m | -M) [<oldbranch>] <newbranch> +'git branch' (-d | -D) [-r] <branchname>... DESCRIPTION ----------- -With no arguments given a list of existing branches -will be shown, the current branch will be highlighted with an asterisk. -Option `-r` causes the remote-tracking branches to be listed, -and option `-a` shows both. -With `--contains <commit>`, shows only the branches that -contains the named commit (in other words, the branches whose -tip commits are descendant of the named commit). + +With no arguments, existing branches are listed, the current branch will +be highlighted with an asterisk. Option `-r` causes the remote-tracking +branches to be listed, and option `-a` shows both. + +With `--contains`, shows only the branches that contains the named commit +(in other words, the branches whose tip commits are descendant of the +named commit). With `--merged`, only branches merged into the named +commit (i.e. the branches whose tip commits are reachable from the named +commit) will be listed. With `--no-merged` only branches not merged into +the named commit will be listed. Missing <commit> argument defaults to +'HEAD' (i.e. the tip of the current branch). In its second form, a new branch named <branchname> will be created. It will start out with a head equal to the one given as <start-point>. @@ -34,12 +39,11 @@ Note that this will create the new branch, but it will not switch the working tree to it; use "git checkout <newbranch>" to switch to the new branch. -When a local branch is started off a remote branch, git can setup the -branch so that linkgit:git-pull[1] will appropriately merge from that -remote branch. If this behavior is desired, it is possible to make it -the default using the global `branch.autosetupmerge` configuration -flag. Otherwise, it can be chosen per-branch using the `--track` -and `--no-track` options. +When a local branch is started off a remote branch, git sets up the +branch so that 'git-pull' will appropriately merge from +the remote branch. This behavior may be changed via the global +`branch.autosetupmerge` configuration flag. That setting can be +overridden by using the `--track` and `--no-track` options. With a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match @@ -53,7 +57,7 @@ has a reflog then the reflog will also be deleted. Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist -in remote repository or if linkgit:git-fetch[1] was configured not to fetch +in remote repository or if 'git-fetch' was configured not to fetch them again. See also 'prune' subcommand of linkgit:git-remote[1] for way to clean up all obsolete remote-tracking branches. @@ -94,7 +98,8 @@ OPTIONS -a:: List both remote-tracking branches and local branches. --v, --verbose:: +-v:: +--verbose:: Show sha1 and commit subject line for each head. --abbrev=<length>:: @@ -105,19 +110,28 @@ OPTIONS Display the full sha1s in output listing rather than abbreviating them. --track:: - Set up configuration so that git-pull will automatically - retrieve data from the remote branch. Use this if you always - pull from the same remote branch into the new branch, or if you - don't want to use "git pull <repository> <refspec>" explicitly. Set the - branch.autosetupmerge configuration variable to true if you - want git-checkout and git-branch to always behave as if - '--track' were given. + When creating a new branch, set up configuration so that 'git-pull' + will automatically retrieve data from the start point, which must be + a branch. Use this if you always pull from the same upstream branch + into the new branch, and if you don't want to use "git pull + <repository> <refspec>" explicitly. This behavior is the default + when the start point is a remote branch. Set the + branch.autosetupmerge configuration variable to `false` if you want + 'git-checkout' and 'git-branch' to always behave as if '--no-track' were + given. Set it to `always` if you want this behavior when the + start-point is either a local or remote branch. --no-track:: - When a branch is created off a remote branch, - set up configuration so that git-pull will not retrieve data - from the remote branch, ignoring the branch.autosetupmerge - configuration variable. + Ignore the branch.autosetupmerge configuration variable. + +--contains <commit>:: + Only list branches which contain the specified commit. + +--merged:: + Only list branches which are fully contained by HEAD. + +--no-merged:: + Do not list branches which are fully contained by HEAD. <branchname>:: The name of the branch to create or delete. @@ -176,10 +190,22 @@ If you are creating a branch that you want to immediately checkout, it's easier to use the git checkout command with its `-b` option to create a branch and check it out with a single command. +The options `--contains`, `--merged` and `--no-merged` serves three related +but different purposes: + +- `--contains <commit>` is used to find all branches which will need + special attention if <commit> were to be rebased or amended, since those + branches contain the specified <commit>. + +- `--merged` is used to find all branches which can be safely deleted, + since those branches are fully contained by HEAD. + +- `--no-merged` is used to find branches which are candidates for merging + into HEAD, since those branches are not fully contained by HEAD. Author ------ -Written by Linus Torvalds <torvalds@osdl.org> and Junio C Hamano <junkio@cox.net> +Written by Linus Torvalds <torvalds@osdl.org> and Junio C Hamano <gitster@pobox.com> Documentation -------------- @@ -187,4 +213,4 @@ Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite |