Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change git origin to a branch of my own

Tags:

git

github

I cloned someone else's repo to my computer from github to try it out. I eventually made some changes to it (locally) that I do not want to commit to the original repo. Instead, I want to create my own fork of the project, apply the changes I made, then push it to my own repo. How do I do this?

like image 483
Brand Avatar asked Jun 01 '11 11:06

Brand


2 Answers

You can add your own repo as a remote and simply push there :

git remote add myFork git://myforkUrl/project.git
git push myFork master

But if you want to work with github you should consider to fork from the github interface.


Resources :

  • GitHub - Fork a repo
  • git remote
  • git push
like image 165
Colin Hebert Avatar answered Sep 19 '22 11:09

Colin Hebert


You need to change what origin points to:

git remote rm origin
git remote add origin git://newAddress/repo.git
git push origin master

Assuming you already have a bare repository already setup on git://newAddress/repo.git

like image 43
ralphtheninja Avatar answered Sep 18 '22 11:09

ralphtheninja