If you're interested in contributing to an open source project, one common way to get started is:
- Fork the project
- Clone it locally
- Create a branch and do some changes
- Once you're ready to share your changes, create a PR and wait for maintainers to review your work.
However, sometimes things don't go as planned. For example, you might accidentally change your origin and find that you can no longer push to your PR. It happens more often then we think. I recently messed up my remote origin(again). So if this happens to you, here's what you can do:
- Checkout to your PR branch
git checkout pr_branch_name
- Check the origin
git remote -v
- Change the origin to point it to the forked repo
git remote set-url origin https://email@example.com/your_username/project_name.git
- commit the changes and push. At this point
git pushshould work.
Finally, Don't forget to check the origin again using git remote -v to make sure it's pointing to the correct location.