Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required. Paperback excluded.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

7 tips for using Git and GitHub the right way

Save for later
  • 3 min read
  • 06 Oct 2018

article-image
GitHub has become a widely accepted and integral part of software development owing to the imperative features of change tracking that it offers. It was created in 2005 by Linus Torvalds to support the development of the Linux kernel.

In this post, Alex Magana and Joseph Muli, the authors of Introduction to Git and GitHub course, discuss some of the best practices you should keep in mind while learning or using Git and GitHub.

7-tips-for-using-git-and-github-the-right-way-img-0

Document everything

A good best practice that eases work in any team is ample documentation. Documenting something as simple as a repository goes a long way in presenting work and attracting contributors. It’s more of a first impression aspect when it comes to looking for a tool to aid in development.

Utilize the README.MD and wikis

One should also utilize the README.MD and wikis to elucidate the functionality delivered by the application and categorize guide topics and material. You should

  • Communicate the solution of the code in the repository avails.
  • Specify the guidelines and rules of engagement that govern contributing to the codebase.
  • Indicate the dependencies required to set-up the working environment.
  • Stipulate set-up instructions to get a working version of the application in a contributor’s local environment.

Keep simple and concise naming conventions

Naming conventions are also highly encouraged when it comes to repositories and branches. They should be simple, descriptive and concise. For instance, a repository that houses code intended for a Git course could be simply named as “git-tutorial-material”.

As a learner on the bespoke course, it’s easier for a user to get the material, compared to a repository with a name such as “material”.

Adopt naming prefixes

You should also adopt institute naming prefixes for different task types for branch naming. For example, you may use feat- for feature branches, bug- for bugs and fix- for fix branches. Also, make use of templates that encompass a checklist for Pull Requests.

Correspond a PR and Branch to a ticket or task

A PR and Branch should correspond to a ticket or task on the project management board. This aids in aligning efforts employed on a product to the appropriate milestones and product vision.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at $19.99/month. Cancel anytime

Organize and track tasks using issues

Tasks such as technical debts, bugs, and workflow improvements should be organized and tracked using Issues. You should also enforce Push and Pull restrictions on the default branch and use webhooks to automate deployment and run pre-merge test suites.

Use atomic commits

Another best practice is to use atomic commits. An atomic commit is an operation that applies a set of distinct changes as a single operation. You should persist changes in small changesets and use descriptive and concise commit messages to record effected changes.

You read a guest post from Alex Magana and Joseph Muli, the authors of Introduction to Git and GitHub. We hope that these best practices help you manage your Git and GitHub more smoothly.

Don’t forget to check out Alex and Joseph’s Introduction to Git and GitHub course to learn how to create and enforce checks and controls for the introduction, scrutiny, approval, merging, and reversal of changes.

GitHub introduces ‘Experiments’, a platform to share live demos of their research projects.

Packt’s GitHub portal hits 2,000 repositories