- Hi, I'm Cameron Mackenzie,
I'm the Editor in Chief over at TheServerSide.com
and I want to help you answer 10
of the most commonly asked Git and GitHub questions.
So the first question that you might get
if you're on a DevOps interview is what is the difference
between Git and GitHub?
For that question, I would say that Git is the tool
that is installed locally
and allows developers to manage code,
manage commit histories,
go back over previous versions of code,
and even potentially connect to other Git repositories
through push and pull commands.
But it really is a tool that's installed locally
on a developer's machine.
GitHub, on the other hand,
is a cloud based offering that wraps around the Git tool
and allows developers to connect to it online,
push their code to it,
almost create a centralized place
in many respects for storing source code.
Now, I do like to emphasize
Git is a distributed version control tool,
as well as GitHub
so we don't wanna think of Git or GitHub
as a centralized tool.
But I think people understand when you say,
"Yeah, that's typically the central place where people
on a project would push their code to that being GitHub."
Also, GitHub provides a variety of services around Git.
So Git is very focused on version control
and managing commit history
but you know, integrating with third party tools,
and even doing things like user management
and authentication, Git doesn't deal with that.
So tools like GitHub,
they wrap tools around that basic Git offering.
Question two,
name two Git commands that are not supported
by GitHub desktop.
So GitHub desktop is good for helping people get started
with GitHub repositories, cloning, pushing, pulling,
even doing versioning
but some of the advanced features like cloning
or not cloning, but cherry picking,
reverting and rebasing,
those still aren't built into the GitHub desktop tool
but that may change over time.
But if you really want a full suite of features,
you know you can stick with a git-gui,
even maybe, you know, Atlassian's offering in that space.
Those are all really great full featured tools.
What are the four states that can be applied
to a commit using the GitHub status API?
Of course, just because your code can be committed,
that is, there's no merge conflicts really should resolve
the conflicts and push the code into your repository,
that doesn't mean that the code compiles
and even if the code compiles,
that doesn't mean all the unit tests pass.
So the API allows you to push code into GitHub
and market with one of four states.
That's error, failure, pending and success.
The fourth question,
name three popular DevOps tools
with which GitHub commonly integrates.
Well, let me see what are some of the tools
that it integrates with well.
You'll typically in a DevOps environment,
integrate with Jira,
you'll definitely be integrating
with a build tool like Maven or Gradle.
Of course, if you're doing continuous integration,
you're gonna be using a tool like Jenkins.
So there's just a handful of tools
that you might be integrating your GitHub repository with.
Fifth question, what does the GitHub unicorn indicate?
Well, of course, unicorns are very rare.
Some may say they don't even exist
and if you actually see a GitHub unicorn,
on your GitHub page,
that means the GitHub page is down.
It's the rainbow unicorn.
So hopefully, you won't see that
and hopefully, GitHub won't be down for any reason.
But if it does go offline for a little while,
they float that GitHub unicorn onto the page.
It's pretty cute.
Sixth question, what is the key motivation
for a paid GitHub subscription?
Until early 2019,
the motivation was to get a private repository.
So formerly, you couldn't get a private repository
without paying for a GitHub subscription.
If you just use the basic free account,
all of the source code that you checked in would be public
for others to see.
So if you wanted something to be private,
you would have to pay the, usually five or $6 a month,
it's not really expensive,
but you'd have to get a developer subscription to GitHub.
They actually changed that in 2019.
As of January 2019,
you can actually create a private repo
with a basic free account.
However, there are some restrictions.
So one restriction is you can't do branch protection rules
with it,
you can't get a wiki with it,
you can't get GitHub Pages
and perhaps the most restrictive one,
the private GitHub repository
on the free tier can only have three collaborators with it.
So if you want more than three contributors to your project,
you're gonna have to go to the paid subscription.
Seventh question,
name two technical insights GitHub provides
about repositories.
That's the good old insights page.
Pulse is interesting.
It tells you the number of merged pulls requests,
proposed pull request, closed issues,
issues that have arisen.
There's a GitHub traffic where it can tell you
how many repository views have happened over the time,
how many times the repo has been cloned,
how many users have cloned the repositories,
which files in the repo are most popular.
So there's a variety of insights you can get
about your repository through the insights page.
There's also links for information about contributors,
community commits, code frequency,
network insight, forks,
all interesting things that GitHub can provide you
about your repository.
Question eight,
how can you stop an addle-minded developer
from accidentally pushing a bad commit to the master branch?
Well, the answer to that is use branch protection rules.
So you can, this is something GitHub provides,
you can't do it at the level of Git,
but you can say,
"Hey, you know what,
for this particular branch,
it requires a pull request before merging,
or we need a GitHub API status check before merging
or we can require a signed commit
or even include just administrators
in branch protection rules."
So there's a variety of ways
that we can protect our branches
but that's the key.
GitHub provides branch protection rules
so that an addle-minded developer
or somebody who's not paying attention
can't accidentally push a bad commit to the master branch.
Question nine, what's the purpose
of a GitHub interaction limit?
Well, things can get heated when you're doing development
and to avoid people flaming each other
or allow your project to cool down.
GitHub allows you to set some interaction limits
and you can limit interactions to only new users,
you can set GitHub interaction limits
where only people who have ever made a commit
can interact with each other,
you can place a limit so that all users
who do not have push access to the repo can't interact
with what's going on in the repo.
But that's the basic idea.
If you want to reduce the number of people
that are interacting with your GitHub repository,
maybe there's a little dissatisfaction going on
in the community,
the GitHub interaction limits are the key.
And finally, the 10th question,
where in a GitHub project can you use a GitHub emoji?
All of the millennials want to use emojis
as much as possible.
Right now you can use them in labels,
so you can put a cute little emoji
in your label as you label your commits.
We may see more and more places where that's available.
Kind of a cute, neat little feature.
Anyways, that's it.
Hopefully, this will help you get
through any DevOps interview
where you need to answer some questions on Git or GitHub.
For more information on Git and various DevOps tools,
head over to TheServerSide.com
and feel free to follow me on twitter at Cameron McKenzie.