Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将分支更改为新的主github_Github - Fatal编程技术网

将分支更改为新的主github

将分支更改为新的主github,github,Github,当我键入“git branch”时,我得到以下结果: Zachs-MacBook-Pro:stocks1 zachsmith$ git branch 77e98af109bd63630b38c1f1ca3937d43715ddf4 add_bootstrap add_stock_model master stocks_download temp * working working#2(backup) 这是否意味着我在分离头“77e98af109bd63630b38c

当我键入“git branch”时,我得到以下结果:

Zachs-MacBook-Pro:stocks1 zachsmith$ git branch
  77e98af109bd63630b38c1f1ca3937d43715ddf4
  add_bootstrap
  add_stock_model
  master
  stocks_download
  temp
* working
  working#2(backup)
这是否意味着我在分离头“77e98af109bd63630b38c1f1ca3937d43715ddf4”的“工作”分支上

我想在现在的位置上成为github的新主人,但我不知道如何在不合并东西的情况下做到这一点。基本上,我很乐意用我现在的位置重新书写大师

我该怎么做

这是否意味着我在分离头“77e98af109bd63630b38c1f1ca3937d43715ddf4”的“工作”分支上

不,它只是意味着:

  • 您在工作分支nammed“
    工作
  • 另一个分支名为“
    77e98af109bd63630b38c1f1ca3937d43715ddf4
    ”(可能是git分支命令中的一些错误)
基本上,我很乐意用我现在的位置重新书写大师

你可以

并用力推动你的工作分支

git push --force origin working:master

你会在“.”中看到类似的方法。

要做到这一点,你有多种选择,一种是删除主分支机构并将你的工作分支机构重命名为主分支机构,但你可能知道,你可能会因此被判处25年监禁和死刑

您还可以重命名旧的主分支,并将工作分支重命名为新的主分支,或者(我最喜欢的方式)您可以使用
-s ours
标志,以保持主分支的完整性,并覆盖工作分支中的所有内容:

git checkout working
git merge -s ours master
git checkout master
git merge working

现在,您的主人将与您的工作分支相匹配。

我之所以要这样做,是因为我想把它推给Heroku,谢谢。这是否意味着“工作”分支将成为本地主分支?我还注意到,合并后,您会收到合并发生地点的通知,例如。
git checkout working
git merge -s ours master
git checkout master
git merge working