DEV Community

Cover image for Make your Github Contributions Cooler😎
ShatilKhan
ShatilKhan

Posted on

Make your Github Contributions Cooler😎

If you are an Open Source Beginner or know a little bit about Open Source & looking to up your PR game, this is the right post for you.

This post generally revolves around some general guidelines on how you can beautify your Github Issues & Pull Requests which can make a lot of difference in understanding PRs & Issues.
These tips mostly come from my own learning & I write so that others can know these little things

Referencing Code

We've all done this, you find a good issue or open a new PR. You add a Description Section or Screenshot Section where you put a Screenshot of the code & add the file path to that code. There's a better way of referencing that code directly from source code file AND you can do it from your VS Code.
Obviously you will first have to clone the Repo you're working on into your Local Machine. Then Open the project in VS Code. Here I'm using a CLI-tool project I made recently.

  • Highlight/select the part of the code or line that you want to reference

Highlight

  • Left Click to bring up Options Menu & Scroll to Open On Remote(Web) Option & finally Open File on Remote

Open Remote

  • Then you will see the code automatically open up in the Remote Repo / Source

Remote Repo

  • Press the three dots on the left hand side & you will see many options, Copy the Permalink note: you can also use the reference in a new issue option

Permalink

  • Now you have a link that you can paste in any Issue, PR or Discussion which directly points to the code.

Paste Permalink Preview
As you can see, you no longer need to write down the entire file path or screen shot of the code. Any one can click & directly be taken to the file/code.

Merge Conflicts

You might not see too many Merge Conflicts if you are starting out or an absolute beginner, but might start to see them after a while contributing to different projects. This are just some basic things I've faced till now.

  • Linting I had a lot of conflicts with linting errors like extra space or new line. If you scroll down in your pull requests you might see a lot of PR Test Runs. Something like this:

CI tests

If you go to the lint checks options you will be presented with the lines where the error occurs

Lint

The file names are given above & the lines containing errors are given directly below. Linting Errors are basically grammatical errors in code. So you have to fix your code grammar. Usually these are missing brackets, semi-colons etc.
Here's some basic stuff:

  • If you see a ' . ' in red color, it means you have an extra space , just delete the extra space
  • If you see a arrow or downward arrow, it means an extra empty line, delete the empty line.

Sometimes you may encounter something like these

main vs branch
The upper portion represents code in your own branch (in this case 'calc') & the lower portion represents code on the main branch. This usually happens when a maintainer force pushes the main branch into your commit. To resolve this you must choose which code you want to keep. It's generally good idea to consult with a maintainer.

And that's pretty much it for this post!
Everything I've mentioned here is just a tiny portion of making Github Contributions. There's a thousand more tips & tricks. If you'd like to see more like this just share in the comments.

If you have such shortcuts or tips you use professionally feel free to comment them bellow.
I might turn this into a series of Github Tips & Tricks if it gets good reach , feel free to leave feedback in the comments.

Happy Coding!

Cat Coder

Top comments (0)