Description of icon when needed10 Min Read

Open source contributions are one of the best ways to give back to the community, build your resume, and meet great people in the tech industry. However, getting started with code contribution in open source can be intimidating if you don't know where to start. What are the baseline skills you need to pick up a good first issue? To help you get started with code contributions, here are five things you should know before getting into open source!

1. Learn how to talk the talk

Like everything else, open source requires knowledge in a few terms to navigate the space successfully. To understand and communicate with other contributors, you need to get yourself into a position where you can talk the talk.

Starting with the below ten words, learn what each word means and how it relates to open source. By understanding these terms, you'll be able to communicate effectively with other contributors on what you're doing, what you want to do and what you need help with.

2. Terminal (Command Line Tool) is your friend

The terminal is a tool to enter text commands directly to the computer. It's used frequently by engineers to avoid using graphical user interfaces (GUIs) or for tasks that do not come with one.

You're not expected to be a terminal expert, but knowing how to move up and down a directory, listing files in the current directory and finding the path of the current directory can help navigate your system to run a command in the correct place.

3. There's no way around it - you need to learn how to Git

Git is a distributed version control system used by all open source projects to manage and keep track of changes made to the project.

To make changes to the project source, you need to utilize Git to at least clone, checkout, add, commit and push.

When you get stuck, just ask your computer for help by running git help. If you need help with a specific command like clone, run git help clone to see the description, options and example of how to run the command.

If you get stuck, don't worry. I don't know how many times I had to reset because I messed up my Git commands. When you do, there is no shame. We all have been there.

To continue your Git learnings further than the minimum outline here, checkout the following resources.

4. You don't have to be a Vim expert, but you do need to know how to escape and quit

Source: https://www.reddit.com/r/ProgrammerHumor/comments/8vihj5/when_you_try_to_exit_vim/

Vim is a text editor that allows you to write and edit text. The idea of a text editor is simple, yet Vim is not an easy tool to use.

Some git commands you run in your terminal may result in automatically opening Vim. When that happens, you just need to know 4 important commands.

When a Vim editor opens up, you typically need to make an edit. Since Vim starts in a state called the normal mode that gives you no ability to edit, you need to start with pressing i to initiate the insert mode.

Once insert mode has been activated, you can now edit the content of the file like a typical editor you would expect. Use your up, down, right and left arrow keys to navigate.

After completing your edits, you can't just save and quit without going back to the normal mode. Therefore, you need to press the esc key to exit the insert mode and go back to the normal mode.

Once in the normal mode, you can now save and quit by pressing :wq + enter. If successful, the Vim editor will close automatically.

If you run into any problems during your Vim encounter, your best friend is the esc key. Always go back to the normal mode and try again. Worst case, esc + :q! to quit without saving.

5. You have to Fork the repos you don't have access to

One thing that may not be so apparent is that open source projects are visible to all but not editable by all.

To edit the project source that's not your own, you need to fork the repository. By forking, you are essentially copying the project into your own space. Then, you have the necessary permission to edit and push your changes to the copied version, a remote repository.

In short, if you don't own the project, fork and then clone the forked repository.

If you directly clone the repository that's not your own, you will not be able to push your changes due to permission issues.

Take a look at how to fork a repository in the official GitHub documentation.

Turn Tips into Action

Let's put the five tips into action by going through how to make a pull request to an upstream project.

  1. Open up your browser and navigate to https://github.com/octocat/Hello-World (upstream repository).
  2. Press the "Fork" button (located on the top right corner) to create your copy.
  3. Verify that you successfully forked the project by navigating to https://github.com//Hello-World (remote repository).
  4. Open up a terminal.
  5. (Only required for first time git users) In the terminal window, type the following commands to set your user name and email address used for commit messages. Email provided must match the email used for your GitHub account.

    git config --global user.name "Firstname Lastname"

    git config --global user.email example@example.com

  6. Clone the remote repository to your local machine.

    1

    git clone https://github.com//Hello-World.git

  7. Change your current path to the "Hello-World" directory.
  8. Change to a new branch called "dev".
  9. Open up the README file using Vim to make changes.
  10. Enter i to start the insert mode, then modify the existing text "Hello World!" to "Hello ".
  11. Enter esc to exit the insert mode.

  12. Enter :wq to save and quit Vim.

  13. Now add your changes by running the following command in your terminal.
  14. Make a commit with a message describing the changes. To learn more about what a commit and a commit message should be, check out Improve Your Git Commits in Two Easy Steps.

    1

    git commit -m "Modify README to test out my git skills"

  15. Push your changes to your remote repository.
  16. Navigate to https://github.com//Hello-World/tree/dev (dev branch of a remote repository) and verify your changes are reflected correctly in the README file.
  17. On the same page, click "Contribute" then the "Open pull request" button.
  18. Give an awesome description of what changes you made and click "Create pull request" to open a new pull request.
  19. Celebrate! You did it! You made your first pull request to an upstream project.

If you are not comfortable with the tools mentioned above, don't worry. Code contributions are not the only way to contribute to open source projects. In addition, there are other GUI-friendly tools like GitHub Desktop that you can use instead. However, when you decide to take on an issue related to making changes to the source code, a basic understanding and experience with Git, Terminal and Vim can help you focus your time on solving the real issue rather than the tools used to manage code.

Before heading to your next open source hackathon or grabbing your first good first issue, try out the short tutorial leveraging the five tips to set yourself up for success!

Stay tuned to the Open Source Blog and follow us on Twitter for more deep dives into the world of open source contributing.

Attachments

  • Original Link
  • Original Document
  • Permalink

Disclaimer

VMware Inc. published this content on 11 January 2022 and is solely responsible for the information contained therein. Distributed by Public, unedited and unaltered, on 11 January 2022 18:27:02 UTC.