Skip to content
Commits on Mar 27, 2012
  1. @peff @gitster

    checkout: suppress tracking message with "-q"

    peff committed with gitster Mar 26, 2012
    Like the "switched to..." message (which is already
    suppressed by "-q"), this message is purely informational.
    Let's silence it if the user asked us to be quiet.
    This patch is slightly more than a one-liner, because we
    have to teach create_branch to propagate the flag all the
    way down to install_branch_config.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 14, 2011
  1. @gitster

    Merge branch 'jn/branch-move-to-self'

    gitster committed Dec 13, 2011
    * jn/branch-move-to-self:
      Allow checkout -B <current-branch> to update the current branch
      branch: allow a no-op "branch -M <current-branch> HEAD"
Commits on Nov 28, 2011
  1. @jrn @gitster

    Allow checkout -B <current-branch> to update the current branch

    jrn committed with gitster Nov 26, 2011
    When on master, "git checkout -B master <commit>" is a more natural way to
    say "git reset --keep <commit>", which was originally invented for the
    exact purpose of moving to the named commit while keeping the local changes
    Signed-off-by: Jonathan Nieder <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 5, 2011
  1. @gitster

    branch: add read_branch_desc() helper function

    gitster committed Sep 21, 2011
    This will be used by various callers that make use of the branch
    description throughout the system, so that if we need to update
    the implementation the callers do not have to be modified.
    Signed-off-by: Junio C Hamano <>
Commits on Sep 17, 2011
  1. @gitster

    branch --set-upstream: regression fix

    gitster committed Sep 16, 2011
    The "git branch" command, while not in listing mode, calls create_branch()
    even when the target branch already exists, and it does so even when it is
    not interested in updating the value of the branch (i.e. the name of the
    commit object that sits at the tip of the existing branch). This happens
    when the command is run with "--set-upstream" option.
    The earlier safety-measure to prevent "git branch -f $branch $commit" from
    updating the currently checked out branch did not take it into account,
    and we no longer can update the tracking information of the current branch.
    Minimally fix this regression by telling the validation code if it is
    called to really update the value of a potentially existing branch, or if
    the caller merely is interested in updating auxiliary aspects of a branch.
    Reported-and-Tested-by: Jay Soffian
    Signed-off-by: Junio C Hamano <>
Commits on Aug 22, 2011
  1. @ConradIrwin @gitster

    Prevent force-updating of the current branch

    ConradIrwin committed with gitster Aug 20, 2011
    "git branch -M <foo> <current-branch>" allows updating the current branch
    which HEAD points, without the necessary house-keeping that git reset
    normally does to make this operation sensible. It also leaves the reflog
    in a confusing state (you would be warned when trying to read it).
    "git checkout -B <current branch> <foo>" is also partly vulnerable to this
    bug; due to inconsistent pre-flight checks it would perform half of its
    task and then abort just before rewriting the branch. Again this
    manifested itself as the index file getting out-of-sync with HEAD.
    "git branch -f" already guarded against this problem, and aborts with
    a fatal error.
    Update "git branch -M", "git checkout -B" and "git branch -f" to share the
    same check before allowing a branch to be created. These prevent you from
    updating the current branch.
    We considered suggesting the use of "git reset" in the failure message
    but concluded that it was not possible to discern what the user was
    actually trying to do.
    Signed-off-by: Conrad Irwin <>
    Signed-off-by: Junio C Hamano <>
Commits on Nov 3, 2010
  1. @moy @gitster

    Change incorrect "remote branch" to "remote tracking branch" in C code

    moy committed with gitster Nov 2, 2010
    (Just like we did for documentation already)
    In the process, we change "non-remote branch" to "branch outside the
    refs/remotes/ hierarchy" to avoid the ugly "non-remote-tracking branch".
    The new formulation actually corresponds to how the code detects this
    case (i.e. prefixcmp(refname, "refs/remotes")).
    Also, we use 'remote-tracking branch' in generated merge messages (by
    merge an fmt-merge-msg).
    Signed-off-by: Matthieu Moy <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 4, 2009
  1. @gitster

    Make git-clone respect branch.autosetuprebase

    gitster committed Mar 3, 2009
    When git-clone creates an initial branch it was not checking the
    branch.autosetuprebase configuration option (which may exist in
    ~/.gitconfig).  Refactor the code used by "git branch" to create
    a new branch, and use it instead of the insufficiently duplicated code
    in builtin-clone.
    Changes are partly, and the test is mostly, based on the previous work by
    Pat Notz.
    Signed-off-by: Junio C Hamano <>
Commits on Feb 20, 2008
  1. @jaysoffian @gitster

    branch: optionally setup branch.*.merge from upstream local branches

    jaysoffian committed with gitster Feb 19, 2008
    "git branch" and "git checkout -b" now honor --track option even when
    the upstream branch is local.  Previously --track was silently ignored
    when forking from a local branch.  Also the command did not error out
    when --track was explicitly asked for but the forked point specified
    was not an existing branch (i.e. when there is no way to set up the
    tracking configuration), but now it correctly does.
    The configuration setting branch.autosetupmerge can now be set to
    "always", which is equivalent to using --track from the command line.
    Setting branch.autosetupmerge to "true" will retain the former behavior
    of only setting up branch.*.merge for remote upstream branches.
    Includes test cases for the new functionality.
    Signed-off-by: Jay Soffian <>
    Signed-off-by: Junio C Hamano <>
Commits on Feb 10, 2008
  1. @gitster

    Move code to clean up after a branch change to branch.c

    Daniel Barkalow committed with gitster Feb 7, 2008
    Signed-off-by: Daniel Barkalow <>
  2. @gitster

    Move create_branch into a library file

    Daniel Barkalow committed with gitster Feb 7, 2008
    You can also create branches, in exactly the same way, with checkout -b.
    This introduces branch.{c,h} library files for doing porcelain-level
    operations on branches (such as creating them with their appropriate
    default configuration).
    Signed-off-by: Daniel Barkalow <>
Something went wrong with that request. Please try again.