在最新版的 Git 2.37.0 中,开启如下配置项后就能直接 git push 新分支,不再需要 --set-upstream origin
--set-upstream origin
1git config --global --add --bool push.autoSetupRemote true
旧版本:
1$ git push2fatal: The current branch example has no upstream branch.3To push the current branch and set the remote as upstream, use4 5 git push--set-upstream origin example
新版本开启配置后:
1$ git push2Total 0 (delta 0),reused 0 (delta 0),pack-reused 03remote:4remote: Create a pull request for example' on GitHub by visiting:5remote: https://github.com/you/repo/pull/new/example6remote:7To github.com:you/repo.git8 * [new branch] example -> example9branch'example' set up to track 'origin/example' by rebasing