开发者

Change git origin to a branch of my own

开发者 https://www.devze.com 2023-03-09 14:04 出处:网络
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 t开发者_Go百科o commit to the original repo. Instead, I want t

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 t开发者_Go百科o 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?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消