gitpush()
{
git push -v 2>&1 | # perform push command, pipe all output
tee /dev/tty | # keep output on screen and pipe it forward
(
cmd=$(sed -n "s/^.*\(git push --set-upstream origin .*\)$/\1/p");
[[ -n "${cmd// }" ]] && (echo "> $cmd"; eval $cmd);
) # if we get output that matches the command to perform, execute it
}
今天我看到了(一个新的?)选项“ push.autoSetupRemote”。
Git config help 说:
If set to "true" assume --set-upstream on default push when no upstream tracking exists for the current branch; this option takes effect with push.default options simple,
upstream, and current. It is useful if by default you want new branches to be pushed to the default remote (like the behavior of push.default=current) and you also want
the upstream tracking to be set. Workflows most likely to benefit from this option are simple central workflows where all branches are expected to have the same name on
the remote.