Many major numerical development companies (ie: Tensorflow, Hugging Face, etc) encourage developers to contribute code projects to their products using GitHub. Sharing/contributing code to a company using GitHub requires performing a Pull-Request, a pull request is the process of making a repository request to the repository owners to add your files.
If you are a busy developer and have never contributed code using a git pull request, this blog post lists the steps on how to quickly perform share your code using a pull request.
Steps to create a GitHub pull request to contribute your project to another project using the GitHub platform
[0] Fork the target project's repository, by clicking on the fork button on the GitHub page of the target repository. A copy of the target repository will be made on your GitHub repository account.
[1] Go to forked repository on your GitHub account, https://github.com/YOUR_REPO_OwnerName/TARGET_REPO_RepoName
[2] Create a codespace on the forked repository on your GitHub account, select YOUR_REPO_OwnerName/TARGET_REPO_RepoName to create the codespace.
[3] Use the terminal on the codespace to create a new branch, where the new branch is called newBranch.
git branch newBranch
[4] Change the current branch to the branch named newBranch.
git checkout newBranch
[5] See all branches. Confirm that the new branch was added, and that the newBranch is selected.
git branch
[6] Make the necessary changes and commit them to your branch. In the example, I am submitting webapp index.html and README.md files.
# Make a folder to add to the TARGET_REPO_RepoName
mkdir folderName_to_add_to_TARGET_REPO_RepoName
echo '' > folderName_to_add_to_TARGET_REPO_RepoName/index.html
# copy-paste source index.html into empty file
echo '' > folderName_to_add_to_TARGET_REPO_RepoName/README.md
# copy-paste source README.md into empty file
[7] Add changes to staging area.
git add .
[8] Commit changes to forked repository [YOUR_REPO_OwnerName/TARGET_REPO_RepoName]
git commit -m "commit message"
[9] Push your branch to your forked repository on GitHub.
git push --set-upstream origin newBranch
[10] Finished with codespace. Delete the codespace.
gh codespace delete --all
[11] Confirm that the codespace is deleted at https://github.com/codespaces.
[12] Go back to your forked repository: https://github.com/YOUR_REPO_OwnerName/TARGET_REPO_RepoName
[13] Click on 'Pull-Request - comparing changes'. Select your branch with the changes and provide a detailed description of your contribution. A submission form will open such that you can type a message to the person that approves the GitHub target repository changes.
[14] Wait for the project maintainers to review and potentially merge your pull request. Go to the pull request page to view any new updates: https://github.com/TARGET_REPO_OwnerName/TARGET_REPO_RepoName/pull/XXXX. XXXX will be random numbers to denote your pull request.
Happy Practicing! 👋
💻 GitHub | 🌷 Practicing Datscy @ Dev.to | 🌳 Practicing Datscy @ Medium
References
- GitHub Docs - Creating a pull request: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
Top comments (0)