Github Tricks: Enhance Your Productivity Like Never Before!

Are you an active Github user who wants to take your productivity to the next level? Well, you’ve come to the right place! In this post, we’ll go through some Github tricks that can help streamline your work and reach your goals more efficiently. So let’s dive right in!

Syntax Highlighting for Code Blocks

Are you tired of code blocks that are not properly highlighted on Github? No worries, Github has got your back! By using syntax highlighting, you can make your code blocks more visually appealing and easy to read.

To add syntax highlighting to your code blocks, simply specify the programming language after triple backticks ```.

For example, the following code snippet enables syntax highlighting for Python code.

```python
print("Hello Github users!")
```
print("Hello Github users!")

Keyboard Shortcuts

Do you sometimes find it hassle navigating through Github using your mouse? Github offers an array of keyboard shortcuts that can help you to save time and navigate more efficiently.

Here’s some of the example shortcuts you can use in a repository.

  • Press “t” to open the file finder
  • Press “g” followed by “c” to go to Code tab
  • Press “g” followed by “i” to go to Issues tab
  • Press “g” followed by “p” to go to Pull requests tab
  • Press “g” followed by “a” to go to Actions tab
  • Press “g” followed by “b” to go to Projects tab
  • Press “g” followed by “w” to go to Wiki tab
  • Press “g” followed by “g” to go to Discussions tab

You can find more keyboard shortcuts by pressing “?” on any page on Github.

User Mentions

If you are looking to collaborate with other Github users on your project, User mentions can help you to tag other Github users and notify them of any updates or requests related to your project.

To mention a Github user, simply type the “@” symbol followed by the username. The user will then receive a notification and be able to join the conversation.

For example, to mention the Github user “whathehekkist”, simply type “@whathehekkist” in your Github comment or issue.

Branch Protection Rules

Branch protection rules allow repository owners/admins to set restrictions on who can push changes directly into specific branches. This helps prevent mistakes or malicious activity from causing problems in important branches like master or main.

To set branch protection rules:

  • Go into Settings > Branches in your repository
  • Select which branch(es) should be protected
  • Set which users/teams have permission levels (read-only vs read/write)
  • Set any required status checks before merging changes into this branch
  • Save changes

Closing Issues via Commit Messages

When working on an issue in Github, it’s possible (and often helpful) to close it automatically via commit message instead of manually closing it later on the Github.

To close an issue via commit message:

  • Start the commit message with “closes #issue-number
  • Push the commit(s) up
  • Check back at the original issue; if all went well, it should now be closed!

Wrapping Up

These were some of the Github tricks – but there are countless others!

Try out these Github tricks and enhance your productivity, collaboration, and overall workflow across teams big and small alike in Github!

Leave a comment