Skip to content

pr-1161/TaoK/feature-branch-autosetupmerge-simple-v3

Re-sending with proposed fixes to concerns raised by Junio.

This patchset introduces a new option to the branch.autosetupmerge setting,
"simple", which is intended to be consistent with and complementary to the
push.default "simple" option.

The push.defaut option "simple" helps produce predictable/understandable
behavior for beginners, where they don't accidentally push to the "wrong"
branch in centralized workflows. If they create a local branch with a
different name and then try to do a plain push, it will helpfully fail and
explain why.

However, such users can often find themselves confused by the behavior of
git after they first branch, and before they push. At that stage, their
upstream tracking branch is the original remote branch, and pull will be
bringing in "upstream changes" - eg all changes to "main", in a typical
project where that's where they branched from. On the other hand, once they
push their new branch (dealing with the initial error, following
instructions to push to the right name), subsequent "pull" calls will behave
as expected, only bring in any changes to that new branch they pushed.

The new option introduced here, with push.default set to simple, ensures
that push/pull behavior is generally consistent - tracking will be
automatically set up for branches that push will work for (and pull will be
consistent for) only.

Tao Klerks (2):
  merge: new autosetupmerge option 'simple' for matching branches
  t3200: tests for new branch.autosetupmerge option "simple"

 Documentation/config/branch.txt |  4 +++-
 Documentation/git-branch.txt    | 18 ++++++++++-------
 branch.c                        | 19 ++++++++++++++++++
 branch.h                        |  1 +
 config.c                        |  3 +++
 t/t3200-branch.sh               | 35 +++++++++++++++++++++++++++++++++
 6 files changed, 72 insertions(+), 8 deletions(-)

base-commit: dab1b7905d0b295f1acef9785bb2b9cbb0fdec84

Submitted-As: https://lore.kernel.org/git/pull.1161.v3.git.1646032466.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1161.git.1645695940.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1161.v2.git.1645815142.gitgitgadget@gmail.com
Assets 2