I cloned a repository thinking I wouldn't need to change anything. Now I want to change something.
I forked the code on github but now I'm unsure what to do next. I don't want to make the changes and then then accidentally commit to the repo I cloned from.
Your local git repository determines where to push / pull based on "remotes". Right now, your local repository two remotes, origin (which right now points to the Github repository you cloned) and heroku (which points to a Heroku repository).
You forked the origin to a new repository on Github; let's say the the old one was https://github.com/bob/website.git and your fork is https://github.com/pixelfairy/website.git.
If you do
git remote -v
You should see something like
origin https://github.com/bob/website.git (fetch)
origin https://github.com/bob/website.git (push)
...
We can change this so that origin points to your fork. Do
git remote set-url origin https://github.com/pixelfairy/website.git
Now git remote -v should output
origin https://github.com/pixelfairy/website.git (fetch)
origin https://github.com/pixelfairy/website.git (push)
...
You can now push and pull as you did before, and it will use your fork instead of the originally cloned repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With