制作当前的分支' leo'推送到远程分支&origin; leonardo_da_vinci'

时间:2015-09-18 10:52:25

标签: git branch git-push

情况:

  • 远程存储库具有分支leonardo_da_vinci
  • 您的本地存储库具有分支leo

在本地存储库中,我想推送leo <-> leonardo_da_vinci 使用命令git push origin (没有跟随leo:...,因为我忘了这一点)。 如何吗

您可以使用git push origin leo:leonardo_da_vinci轻松完成此操作, 但是如何配置git来使用git push

我尝试使用--set-upstream-to--track, 并将.git/configpush = refs/head/leo:leonardo_da_vinci添加到分支leo部分。 没有运气。

以下是.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = /some_url/
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "leo"]
    remote = origin
    merge = refs/heads/leonardo_da_vinci
[branch "origin/leonardo_da_vinci"]
    remote = .
    merge = refs/heads/leo

我的git配置push.default设置为simple

1 个答案:

答案 0 :(得分:1)

如果分支if(argc > 2) { int base = atoi(argv[1]); int exp = atoi(argv[2]); } 是签出的分支,那么简单leo就足够了,因为上游分支git push已设置(with git branch -u或{{ 3}})

如果您至少需要leonardo_da_vinci

但不是git push origin leo,因为git push leo的第一个参数是远程,而不是分支。

确保git push设置为 git config push.default 请参阅“after the first git push -u origin leonardo_da_vinci”。

相关问题