![]() ![]() On GitHub, repositories can have multiple collaborators and can either be public or private. The repository contains all the relevant project files, including documentation, and also stores the revision history for each file. Create a Copy of the RepositoryĪ repository, or repo for short, is essentially the main folder of a project. You can become more familiar with open-source projects by reading through this introduction. For this reason, you will need to create a personal access token or add your SSH public key information in order to access GitHub repositories through the command line.įinally, you should identify an open-source software project to contribute to. You can do so through the GitHub website,, and can either log in or create your account.Īs of November 2020, GitHub removed password-based authentication. You’ll also need to have or create a GitHub account. You can check if Git is installed on your computer and go through the installation process for your operating system by following this guide. ![]() You should have Git installed on your local machine. This tutorial will guide you through making a pull request to a Git repository through the command line so that you can contribute to open-source software projects. Open-source projects that are hosted in public repositories benefit from contributions made by the broader developer community through pull requests, which request that a project accept changes you have made to its code repository. Many projects maintain their files in a Git repository, and platforms like GitHub have made sharing and contributing to code accessible, valuable, and effective. We need to get the local branch name so we know which branch we're going to compare in the pull request.Git is an open-source distributed version control system that makes collaborative software projects more manageable. Grab the Local Branch Name ( branch_name) We have now generated the GitHub URL for the remote repository regardless of whether the repository was cloned using SSH or HTTPS. This is usually only applicable if you have multiple remotes configured in your repo and one of them is not a GitHub remote. The final awk command filters out any non-GitHub URLs. So at this point, we have the we use the sed command to modify the text to make it a GitHub into Github_url = ` git remote -v | awk '/fetch/, prints the second of those items. Using commands like git, awk, sed, and cut, it generates the GitHub Pull Request URL using the remote configured in your local repository. The openpr() function does all of the heavy lifting. Bash Functions to Open a GitHub Pull Request I'll post my functions here and we can go over what they're doing. I recommend using Oh My Zsh, since you're able to easily add functions to the ~/.oh-my-zsh-custom/custom/functions.zsh file. The process to automate this is a bit more complicated than can be achieved using a bash alias, so we're going to use bash functions. I highly recommend reading his blog post. I have made some minor improvements since then. My colleague Logan Henson mentioned this in "Tip 3" of his incredibly helpful post, Building a Great Pull Request. Wouldn't it be nice if you could skip all these steps with one command? Jose can help! Finally, you can start writing your PR and share it. Then you have to manually select the branch you just published. Next, you have to open up the GitHub repo and click on the "New pull request" button. First, you have to push the branch to your remote repository. Unfortunately, you have a few mind-numbing steps to take before everyone can bask in the glory of your code. Your command line is telling you that you have a clean branch and you want to share it with the world RIGHT NOW! ![]() You write up a snazzy commit message and hit enter. You finally did it! You finished writing your new feature and it's fully tested. ![]()
0 Comments
Leave a Reply. |