diff options
author | Tao Klerks <tao@klerks.biz> | 2022-04-29 11:56:46 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-29 20:20:55 +0200 |
commit | 05d57750c66e4b58233787954c06b8f714bbee75 (patch) | |
tree | 5205a9e18538dfa9e205b3fee4f8806f74b10e2d /transport.h | |
parent | push: default to single remote even when not named origin (diff) | |
download | git-05d57750c66e4b58233787954c06b8f714bbee75.tar.xz git-05d57750c66e4b58233787954c06b8f714bbee75.zip |
push: new config option "push.autoSetupRemote" supports "simple" push
In some "simple" centralized workflows, users expect remote tracking
branch names to match local branch names. "git push" pushes to the
remote version/instance of the branch, and "git pull" pulls any changes
to the remote branch (changes made by the same user in another place, or
by other users).
This expectation is supported by the push.default default option "simple"
which refuses a default push for a mismatching tracking branch name, and
by the new branch.autosetupmerge option, "simple", which only sets up
remote tracking for same-name remote branches.
When a new branch has been created by the user and has not yet been
pushed (and push.default is not set to "current"), the user is prompted
with a "The current branch %s has no upstream branch" error, and
instructions on how to push and add tracking.
This error is helpful in that following the advice once per branch
"resolves" the issue for that branch forever, but inconvenient in that
for the "simple" centralized workflow, this is always the right thing to
do, so it would be better to just do it.
Support this workflow with a new config setting, push.autoSetupRemote,
which will cause a default push, when there is no remote tracking branch
configured, to push to the same-name on the remote and --set-upstream.
Also add a hint offering this new option when the "The current branch %s
has no upstream branch" error is encountered, and add corresponding tests.
Signed-off-by: Tao Klerks <tao@klerks.biz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.h')
-rw-r--r-- | transport.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/transport.h b/transport.h index 12bc08fc33..b5bf7b3e70 100644 --- a/transport.h +++ b/transport.h @@ -145,6 +145,7 @@ struct transport { #define TRANSPORT_PUSH_OPTIONS (1<<14) #define TRANSPORT_RECURSE_SUBMODULES_ONLY (1<<15) #define TRANSPORT_PUSH_FORCE_IF_INCLUDES (1<<16) +#define TRANSPORT_PUSH_AUTO_UPSTREAM (1<<17) int transport_summary_width(const struct ref *refs); |