change branch into new master github

When I type "git branch" i get this:

Zachs-MacBook-Pro:stocks1 zachsmith$ git branch
  77e98af109bd63630b38c1f1ca3937d43715ddf4
  add_bootstrap
  add_stock_model
  master
  stocks_download
  temp
* working
  working#2(backup)

Does this mean i am on "working" branch of the detached head "77e98af109bd63630b38c1f1ca3937d43715ddf4"?

i want where I am now to become the new master on github, but I am not sure how to do that without merging things. basically I would be happy to just re-write the master with where I currently am.

How can I do this?


Does this mean I am on "working" branch of the detached head "77e98af109bd63630b38c1f1ca3937d43715ddf4"?

No, it just means:

  • you are on the working branch nammed " working "
  • there is another branch named " 77e98af109bd63630b38c1f1ca3937d43715ddf4 " (probably some mishap in the git branch command)
  • basically I would be happy to just re-write the master with where I currently am.

    You can rename the remote master

    git branch old_master origin/master
    git push origin old_master
    

    And force push your working branch

    git push --force origin working:master
    

    You would see a similar approach in "Rename master branch for both local and remote Git repositories".


    You have multiple options in order to do that, one is to delete the master branch and rename your working branch as master, but you might know you can be sentenced up to 25 years of jail and death penalty for that.

    You can also rename your old master branch and rename your working branch as the new master, or (my favourite way) you can use the -s ours flag so you keep your master intact and you overwrite everything from your working branch:

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

    And your master now will match to your working branch.

    链接地址: http://www.djcxy.com/p/90400.html

    上一篇: 如何使用PHP输出大量文件而不会耗尽内存

    下一篇: 将分支变成新的主Github