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?
Asked
Active
Viewed 313 times
-1
-
1So is there any remote repository left at all? – Thilo Jan 20 '16 at 12:51
-
There are 2, but they are copies of each other – Jorge Kageyama Jan 20 '16 at 14:00
-
1Why do you want to do this? – g24l Jan 20 '16 at 14:14
2 Answers
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.
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 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