BACKGROUND IMAGE: deepagopi2011/stock.adobe.com
As organizations successfully implement their DevOps roadmaps, distributed version control systems, such as Git and GitHub, play a bigger role in everyday operations. If you are interested in landing a DevOps job, you'll want to be ready for the tough GitHub interview questions and answers that gauge a candidate's version control competency.
Tough GitHub interview questions
Before we start, note that these GitHub interview questions and answers focus solely on the features that the cloud-based GitHub service provides and not the Git tool independently or Git-and-GitHub integration.
Before you jump into the answers, read the individual questions, and see how well you can formulate your own answers.
- What is the difference between Git and GitHub?
- Name two Git commands that are not supported by GitHub Desktop.
- Which four states can be applied to a commit using the GitHub status API?
- Name three popular DevOps tools with which GitHub commonly integrates.
- What does the GitHub unicorn indicate?
- What is the key motivation for a paid GitHub subscription?
- Name two insights GitHub provides about repositories.
- How can you stop an addled developer from accidentally pushing a bad commit to the master branch?
- What is a GitHub interaction limit?
- Where in a Git project can you use a GitHub emoji? Provide an example of three GitHub emoji.
GitHub interview questions and answers
As always, it's not good enough to simply memorize the answers and regurgitate what is written here. If you want to land that DevOps job, make sure you can articulate the answers to these interview questions on GitHub in your own words. If you can do that, you'll be one step closer to that new job.
1. What is the difference between Git and GitHub?
Git is a distributed version control tool that developers install on local machines and use to track commit histories, merge files and share code with fellow developers. In comparison, GitHub is a cloud-based source code repository built around the Git tool. Along with providing a central location from which Git users can push and pull code, GitHub also adds a variety of services and features that are not native to Git, such as forking, user management, online editing and branch protection.
Git is maintained by The Linux Foundation, while GitHub was acquired by Microsoft. Git competes with other version control tools, such as Subversion and Mercurial. GitHub competes with GitLab, Atlassian Bitbucket and other SaaS-based services.
Candidates being asked GitHub interview questions will often be told to differentiate between the online service and the Git tool itself, so be prepared when the opportunity arises.
2. Name two Git commands that are not supported by GitHub Desktop.
The GitHub Desktop app is designed primarily to simplify the most commonly used functions. It supports basic Git commands, such as init, add, commit, push, pull and fetch. It does not currently have support for more advanced Git capabilities, including the revert and cherry-pick commands.
It should be noted that the GitHub Desktop app enables a developer to open a terminal window and lets the developer manually issue Git commands, such as reset and cherry-pick.
3. What four states can be applied to a commit using the GitHub status API?
Just because a Git commit succeeds without conflict doesn't mean the code in question compiles, nor does it guarantee that any unit or integration tests pass. As such, the GitHub status API enables you to mark commits with one of four statuses: error, failure, pending or success.
The GitHub status API is often used by CI tools that merge topic branches into feature branches and then push the newly generated commit on the feature branch back to GitHub. It is also possible to configure branch protection rules to inspect the incoming commit status and reject the push if it is flagged as anything but a success.
4. Name three popular DevOps tools with which GitHub commonly integrates.
As a source code repository, GitHub tends to be the foundation for any organization that builds a DevOps-based infrastructure. As such, GitHub commonly integrates with CD software, such as Jenkins; Maven repositories, such as Artifactory; bug tracking software, such as Manuscript; and Agile workflow tools, such as Jira.
If you answer a GitHub interview question about peripheral tools, it's a good idea to mention any tools you have experience with and have integrated.
5. What does the GitHub unicorn indicate?
Nobody will ever believe you if you say you saw a unicorn. You will, however, see the GitHub unicorn if there's site maintenance or a temporary outage. Don't expect it to happen often, though.
6. What is the key motivation for a paid subscription?
Prior to a change in the subscription model that occurred in January 2019, the primary motivation for a paid subscription was the ability to make repositories private. When on the free tier, all repositories were publicly viewable. However, to bring themselves in line with competitors like Atlassian Bitbucket and GitLab, the basic account is allowed to mark a repository as private. However, there are limitations. Private GitHub repositories created with a basic account:
- cannot implement branch protection rules;
- are not given access to a project wiki;
- cannot take advantage of the GitHub Pages feature; and
- are limited to three contributors.
Developers interested in these features within the scope of a private GitHub repository will need to upgrade to a GitHub Pro paid subscription.
7. Name two insights GitHub provides about repositories.
Two interesting DevOps metrics GitHub provides through its insights tab are the repository's pulse and the project's traffic, although you should be ready to mention more than just two when being quizzed with GitHub interview questions.
The pulse provides interesting information, such as the number of merged pull requests, proposed pull requests, closed issues and new issues.
The GitHub traffic insight tool will graph repository views over time and also indicate the number of times the repository has been cloned, how many Git users have cloned the repository and which files are most popular.
Other GitHub insight pages include:
- code frequency
- dependency graph
8. How can you stop an addle-minded developer from accidentally pushing a bad commit to the master branch?
A treasured GitHub feature is the application of branch protection rules. These rules enable the GitHub administrator to specify important branch names that can neither be deleted nor be the subject of a forced push without a user having administrative privileges.
To apply even more granular GitHub branch protections:
- require pull request reviews before merging;
- require a GitHub API status check to pass before merging;
- require signed commits; and
- include administrators in the branch protection rules.
Because Git branch protection is not native to the Git tool, it is a common interview question.
9. What is a GitHub interaction limit?
Toward the end of a development sprint, with time running out and developers anxious about getting Agile points on the Scrum board, temperatures in the office can rise. But if developers need to cool off for a while, organizations can place interaction limits on a given repository. This will restrict who can comment, create open issues and create pull requests for a 24-hour period or until the GitHub interaction limits are rescinded, whichever comes first.
The interaction limits can be configured in three different ways:
- place GitHub interaction limits only on new users;
- place a GitHub interaction limit on people who have never made a commit; or
- place a GitHub interaction limit on all users who do not have push access to the repository.
10. Where in a Git project can you use a GitHub emoji? Provide an example of three GitHub emoji.
GitHub emoji were introduced in February 2018 and can be applied to labels to describe issues and pull requests.
Three popular GitHub emoji include :bug:, :hankey: and :boom:.
Interview questions on GitHub
These sample GitHub interview questions and answers are by no means exhaustive, but they should give you a good idea of what types of DVCS topics you need to be ready for when you apply for a DevOps job.
GitHub is popular because it provides a wide array of services and features around the singularly focused Git tool. But if you're familiar with some of the most important GitHub features, such as branch protection, repository insights and even GitHub Desktop, you should have no problem responding to interview questions on GitHub.
DevOps job preparation
Prepare yourself for that next DevOps job with the following key resources:
- Learn the five basic Git commands every DevOps pro needs to master.
- Understand the build lifecycle of Apache Maven.
- Learn to automate build jobs with Jenkins CI.
- Test yourself with this Git quiz.
- Learn how to integrate Jenkins and Artifactory
- Prepare with these sample DevOps interview questions.
With a strong knowledge of Git, DevOps, Jenkins and Maven, you will be able to walk into your GitHub interview with confidence and, we hope, walk out with a job.