-1

I had a git repo in a computer which no longer is available, and I have a local branch which I want to be the new origin/master. I read Make the current git branch a master branch. It involves merging the master and local branches, but I don't have access to master anymore. Is there any way to make my local branch the master one?

Community
  • 1
  • 1
Jorge Kageyama
  • 393
  • 4
  • 17

2 Answers2

0

If the master branch is not available anymore you can just create the master branch from your local one and use that one:

git checkout -b master

After, if you want to use this branch as master, you can push it to the server:

git push -f

This server you may have to link as a remote.

BSMP
  • 4,596
  • 8
  • 33
  • 44
eesdil
  • 1,931
  • 3
  • 16
  • 25
0

You should push as follows:

git push --force --set-upstream origin local_name_of_branch:master
g24l
  • 3,055
  • 15
  • 28
  • Maybe I am doing something wrong, but after running the command, has problems resolving the host name (because the host does not exist) – Jorge Kageyama Jan 20 '16 at 14:04
  • @JorgeKageyama , you have not setup an origin ? ? – g24l Jan 20 '16 at 14:15
  • @JorgeKageyama not to mention that you say that you want it to become the new `origin/master` ... that's foo without an origin. – g24l Jan 20 '16 at 14:17