What will you learn on this page
On this page, you will learn a lot about GitHub and its features.
To begin with, you'll learn everything you need to know to get started efficiently on GitHub and master the fundamentals of the platform.
Then, you'll discover our best tips and best practices to take your GitHub experience to the next level.
Finally, you'll deepen your knowledge and skills on specific GitHub features like GitHub Actions or GitHub Issues.
Are you ready?
Table Of Content
GitHub vs GitLab vs BitBucket, Which Is the Best?
GitHub Basics - Getting Started
GitHub Best Practices, Tips & Tools
What is GitHub?
GitHub, Inc. is a hosting service that specializes in software development and version control using Git. It offers the benefits of distributed Git version control, access control, bug tracking, software feature requests, task management, continuous integration, and wikis, all in one platform. Based in California, the company became a subsidiary of Microsoft in 2018.
GitHub is widely utilized for hosting open-source software projects and has a large developer community, boasting over 100 million developers and over 372 million repositories, with 28 million of those being public. As of November 2021, it is the leading source code host.
Why Should You Use GitHub?
GitHub provides a platform for project management and collaboration among developers and project managers.
With GitHub, packages can be published either privately within the team, or publicly to the open-source community, and can be easily downloaded for use or reuse.
The platform facilitates effective team management, with tools like Issue and Pull Request Locking keeping everyone organized and focused.
Through pull requests, organizations can review and propose new code, with team members able to discuss any implementations and proposals before making changes to the source code.
GitHub also prioritizes code safety, using tools to detect vulnerabilities that may be missed by other tools. Teams work together to secure the entire software supply chain.
Finally, GitHub offers easy code hosting, with all code and documentation in one place and a vast number of repositories each with its own tools for hosting and releasing code.
To summarize, GitHub is great to:
- Improve collaboration between developers, managers, and globally all project stakeholders,
- Make file management and remote access easy,
- Nice interface to work on Git,
- Create and develop his professional network, since GitHub is a Social Network,
- Host and maintain Open-Source Projects as well as private projects.
GitHub vs GitLab vs BitBucket, Which Is the Best?
You might be in the middle of deciding which version control platform you want to work on.
You have a wide choice of alternatives, among them: GitHub, GitLab or BitBucket.
Each one has its advantages and disadvantages and it can be difficult to compare them effectively.
But lucky you, we have already done this work for you and established a kind of benchmark evaluating the different alternatives according to their features, prices, security, and control.
To find out more, don't hesitate to read our article GitHub vs GitLab vs BitBucket.
GitHub Basics - Getting Started
Now that you know what GitHub is, what are the advantages of the platform and under what conditions its use is most judicious, let's get to the heart of the matter.
You will discover the basic actions and operations you can perform in GitHub. On the program: launching a project, comparing branches, and merging code.
How Can I Start a New Project on GitHub?
Starting a project on GitHub involves the following steps:
- Creating a GitHub account
- Setting up a new repository for the project
- Adding a README file to the repository to explain the project
- Adding files and directories to the repository
- Committing changes to the repository regularly
- Collaborating with others by inviting them to contribute to the project
- Managing the project through issues and pull requests.
Read and learn more about starting a project on GitHub
How Should I Merge Pull Requests on GitHub?
To merge a pull request on GitHub directly, you have to be a repository manager or a team leader. However, pull requests are reviewed before being merged into the main branch.
Why? Because this review spots and cuts down on potential issues with code quality and consistency down the line.
In fact, the merging process itself is quite simple, there are a few different ways to handle it though.
Here, you will learn about the three options you have to manage standard pull request merging.
- The default option on GitHub: Move all feature branch commits to the main branch.
- Second option: Squash all commits then move the resultant commit to the main branch.
- Third option: Rebase all commits and merge the results.
If you want to learn more about merging pull requests, even into protected branches, or automate your pull request Merging, read our specific article about Pull Request Merging.
How Do You Compare Two Branches in GitHub?
GitHub Desktop is a user-friendly tool that streamlines the process of managing your projects on GitHub. It has a graphical interface that makes it easy to view and compare the different branches of your project. To compare branches, you simply need to select the "compare to branch" option under the "Branch" menu at the top of the interface. This will give you a quick overview of the differences between the two branches. You can also expand the view to a split screen, and even remove whitespace changes from the comparison to make it more effective.
For further information, or if you want to learn more about comparing two branches in Git, you can read our article entitled “How to Compare Two Branches in GitHub?”
How Do You Merge Branches in GitHub?
Now that you know how to merge pull requests, let’s focus on how to merge GitHub branches. Nothing too complex, here is how to do it in 8 steps:
- Go to your repository, then click the Pull Requests button. You can find it between the Issues and Actions buttons.
- Choose and click on the pull request you want to merge into the main branch.
- Now, you face three options you just discovered above (merge every commit, squash the commits, or rebase each commit).
- Write a comment, or accept the default message from GitHub.
- Scroll below the message field and choose a Git author email address.
- Click on “Confirm merge”, “Confirm squash and merge”, or “Confirm rebase and merge”, depending on which option you choose in Step 3.
- If the merge is successful, GitHub displays a note confirming the merge.
- You can now delete the branch by clicking Delete branch to keep things nice and neat.
For a deeper understanding, you can still read the detailed article about merging branches in GitHub.
GitHub Best Practices, Tips & Tools
Now that you have mastered the essential features of GitHub, it's time for you to take it to the next level.
In this chapter, you'll discover the best practices used by Mergify engineers, as well as tips and tools that will make you a GitHub expert.
GitHub Code Review - Best Practices
GitHub's code review process is a crucial part of the standard GitHub flow, taking place after each pull request. Although each team may have its own approach to review handling, it is typically recommended to have at least one thorough review before merging code into the main repository.
The following best practices should give you a solid foundation for your code reviews and help you make improvements:
1. Cover important topics.
2. Limit review time.
3. Automate whenever possible.
If you want to know more, you can read our article dedicated to the code review process. This article covers, among other things, the process within a CI/CD pipeline.
Best GitHub Productivity Tools
An efficient developer is a equipped developer with the right tools. This statement obviously applies to GitHub.
Through this list, you will discover the best tools to gain productivity on GitHub.
All these tools are 100% approved by the Mergify team. If this is not a guarantee of quality…
Scheduling:
- TrackingTime.
- Todo.txt.
Focusing:
- Focusmate.
- Cold Turkey.
Coding and committing:
- Searchcode.
- Marker.io.
- Mergify 😏
Want more explanation and details on each of the tools? Go to our detailed article to learn more about all these tools that will boost your productivity on GitHub.
GitHub's Users' Favorite Chrome Extensions
Discovering the appropriate Chrome extension may not seem trivial, however it can significantly enhance your daily workflow if you frequently work with GitHub. With the help of simple Chrome plugins, you can eliminate repetitive and time-consuming tasks and make your experience as a GitHub user much more efficient. Below are some of the best Chrome extensions every GitHub user should be aware of:
1. GitHub Code Folding
2. GitZip for GitHub
3. Render Whitespace on GitHub
4. OctoLinker
5. Notifier for GitHub
6. Better Pull Request for GitHub
7. Sourcegraph
8. Octotree
9. Lovely forks
10. GitHub Repository Size
Once again, if you want more details and to understand how these 10 Chrome Extensions for GitHub work, read our article .
GitHub Storage Limits, Are There Alternatives?
GitHub has some limitations on file and repository size that developers have to deal with. For projects that depend on particularly large files, knowing these limitations but also the alternatives to overcome them can make a huge difference.
GitHub releases: The Alternative to repository size limits on GitHub
Fortunately, there are other ways to associate large files with your code on the platform.
GitHub releases are the platform's specific way to offer versioned releases in a flexible way. Instead of keeping all the versions of your software in your repository, you can simply specify a new version.
GitHub individual file storage limits
In addition to the overall size limitations, GitHub also places some constraints on the size of individual files in a repository.
Note that the maximum file size differs depending on the access method you choose to interact with your repository. To understand the two options, check our article.
Git Large File Storage or "LFS": Alternatives to individual file storage limits on GitHub
File storage limits can really hold you back from achieving your development goals.
Thankfully, in 2015, GitHub introduced its large file storage feature. An extremely convenient option for developers looking to use all sorts of large files in their workflows
Why Do You Need a GitHub Backup?
Most of the time, GitHub backups are the only way for an organization to ensure that its production code is truly secure. The value of GitHub backups cannot be overstated, whether your team builds a simple Git repository backup script to manage the process or chooses a third-party solution to handle it.
As teams refine their workflows to revolve around GitHub, the risk of service failure, inaccessibility and exposure to threats targeting GitHub systems increases.
If suddenly taking GitHub down for a period of time can have a significant impact on your team's ability to work, an appropriate backup strategy should be implemented.
GitHub Backup, our Best Practices
Choose the best storage provider
Moving data to a third-party storage system always involves trust. When choosing services to provide such critical functionality to your team, it's worth paying close attention to their service level agreements to ensure your data will be as secure and accessible as necessary.
Choose GitHub backup tools carefully
It's critical for developer teams looking to use backup tools for their GitHub repo to take into account whether these tools can manage both the repositories themselves and the metadata associated with them.
Metadata on GitHub includes vital details such as:
- GitHub issues.
- Labels.
- Topics.
- Releases.
- Pull requests complete with descriptions and comments.
- Comments on individual commits.
Top GitHub Features
In this last part, we will focus on some of GitHub's key features.
One by one, you will learn to know them and master them with the tips of your fingers.
GitHub Issues
1. Creating Issues
Issues are relatively simple to create. They allow your project's end users to contribute by opening new issues and greatly help the development process. There are a few important steps when it comes to creating new questions:
- Adding tasks (you can also create a task list).
- Adding custom fields.
- Saving views.
2. Managing Discussions
Each issue should come with a unique comment thread through which the team can interact. Discussions are really helpful to coordinate ideas and clarify complex needs.
GitHub makes commenting easy by using markdown characters and emojis.
You can also subscribe to specific issues or the repository as a whole. All the changes will be highlighted through notifications in your account and a daily recap mail is sent to your email address.
To dig deeper into the subject, we advise you to have a look at our article dedicated to the use of GitHub Issues ;)
GitHub Actions
GitHub Actions are a powerful tool that allows you to automate your workflow.
With the launch of GitHub Actions, GitHub has taken the DevOps world by storm. All the new buzzwords, such as Serverless, Functions as a Service (FaaS), and Platform as a Service (PaaS), have become much more accessible.
Is GitHub Actions a CI?
What Kind of GitHub CI Can Be Configured with Actions?
For CI purposes, unit tests are the core requirements of a team. Configuring them to fit your team's workflow should eliminate tedious manual testing and speed up overall productivity.
Essential to any CI workflow, Unit tests are especially useful when they are fully automated and integrated into a complete CI/CD pipeline. For CI workflows, unit tests are most of the time configured to be triggered by pull requests.
GitHub Actions supports many unit test formats. Here are some useful unit testing tools available for use as GitHub Actions:
- PHPUnit.
- Angular Full CI.
- Test Server Configs.
You will find further information about unit test tools, and best practices for GitHub Actions in our dedicated article.
Running GitHub Actions Only on Certain Pull Requests
GitHub Actions comes with high flexibility and allows you to decide precisely how to run all your workflows.
You will often need to trigger a job for a specific pull request which matches some criteria. Let's see how you can do it.
You can trigger a job based on the presence of a label on a pull request.
Set up your workflow to be triggered when the label on a pull request changes, and filter based on the presence of the label.
When a pull request has a new label added or removed, the event triggers the workflow.
If you are looking for concrete examples, check our article to deeply understand how you can run GitHub Actions on certain pull requests.
Is GitHub Actions Better than Jenkins?
Here's the big question, the one you've been waiting for!
GitHub Actions vs. Jenkins, which is better?
Long story short: both are great, Jenkins and GitHub Actions are two powerful options worth considering when planning your project CI/CD strategy.
But if you had to select a unique winner, it would be GitHub Actions. Here is why: enormous extensibility coupled with simplicity. That's why.
And if you need a final argument, GitHub Actions meshes extraordinarily well with Mergify.
If you want more arguments and understand the differences between GitHub Actions and Jenkins, read our article.