Created
February 22, 2021 13:02
-
-
Save josefigueredo/1335759b5a3cd1bfc1d94d2d5d199272 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Whenever I want to create pull requests to a repo that I don't have write access to, I: | |
1. Fork the original repo to my account. | |
2. Clone the original repo to my local machine. | |
3. Add my fork as an additional remote and make it the push default. | |
4. Make changes in a new branch locally. | |
5. Push this branch to my fork. | |
6. Create a pull request from there. | |
``` | |
git clone https://github.com/<origin_org>/<repo_name>.git | |
cd <repo_name> | |
git remote add fork https://github.com/<your_name>/<your_repo>.git | |
git config remote.pushDefault fork | |
``` | |
This way, at a later time point I can easily: | |
1. Pull changes from origin into the local master branch. | |
2. Create another contribution branch. | |
3. Push that to my fork. | |
4. Create a new pull request. | |
``` | |
cd <repo_name> | |
git checkout master | |
git pull | |
git push # update the fork, which can be relevant for continuous integration checking against the master branch | |
git checkout -b new-contribution-branch | |
# make changes and commit | |
git push | |
``` | |
## Sources: | |
* Setting the push default: <https://stackoverflow.com/a/30488025> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment