本文介绍了他们是否只是将push.default设置为`current'才适用于当前推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的git配置中将 push.default 选项设置为 simple ,因为我认为它使得更多这样我就不会在我的远程仓库上创建不需要的分支,如果我无意中推送了某些东西。

I have setup the push.default option to simple in my git config, because I think it makes more sense so that I don't create unwanted branches on my remote repository if I push something inadvertendly.

然而,有时候,我知道这个推动会创建一个新的分支在远程,所以我想告诉git,对于这个特定的命令,我愿意将push.default配置更改为 current (以便它创建一个与我目前使用的名称相同的分支),但仅限于该命令。

However, sometimes, I know that this push is going to create a new branch in the remote, so I'd like to tell git that for this specific command, I'm willing to change the push.default config to current (so that it creates a branch of the same name as the one I'm currently in), but only for that command.

他们是使用git来做到这一点的一种方式吗?或者我应该创建一个bash别名?

Is they a way to do this using git ? Or should I just create a bash alias ?

推荐答案

您可以尝试:

You can try the -c option of the git command:

git -c "push.default=current" push -u origin newBranch

使用:

Using:

-c <name>=<value>



这篇关于他们是否只是将push.default设置为`current'才适用于当前推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 08:58