gpt4 book ai didi

git - 在 git 上游和在推送中使用 -u 标志

转载 作者:IT王子 更新时间:2023-10-29 01:00:12 25 4
gpt4 key购买 nike

在将提交推送到某个 git 仓库时使用 -u 标志有什么用?我的意思是 git push origin mastergit push -u origin master 有什么区别?谁能描述一下它的用法?

最佳答案

git(1) 手册页说:

-u, --set-upstream

For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch..merge in git-config(1).

基本上,当您想将 origin 设置为分支的上游远程时,您可以使用此标志。如果您不想每次使用 git pull 时都手动指定远程,则需要这样做。

另见

http://git-scm.com/book/en/Git-Branching-Remote-Branches#Tracking-Branches

关于git - 在 git 上游和在推送中使用 -u 标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11174948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com