GitHub Essentials
eBook - ePub

GitHub Essentials

Unleash the power of collaborative development workflows using GitHub, 2nd Edition

Achilleas Pipinellis

Share book
  1. 178 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

GitHub Essentials

Unleash the power of collaborative development workflows using GitHub, 2nd Edition

Achilleas Pipinellis

Book details
Book preview
Table of contents
Citations

About This Book

This book will teach you what you need to know to start using GitHub effectively for collaborating and working on your software projects.About This Bookā€¢ Effectively use GitHub by learning its key features to leverage the power of Git and make collaboration on code easy to work with.ā€¢ Be more productive on the development workflow of your projects using the valuable toolset that GitHub provides.ā€¢ Explore the world of GitHub by following simple, step-by-step, real-world scenarios accompanied by helpful, explanatory screenshots.Who This Book Is ForThis book is for experienced or novice developers with a basic knowledge of Git. If you ever wanted to learn how big projects such as Twitter, Google, or even GitHub collaborate on code, then this book is for you.What You Will Learnā€¢ Create and upload repositories to your accountā€¢ Create organizations and manage teams with different access levels on repositoriesā€¢ Use the issue tracker effectively and add context to issues with labels and milestonesā€¢ Create, access, and personalize your user account and profile settingsā€¢ Build a community around your project using the sophisticated tools GitHub providesā€¢ Create GitHub pages and understand web analyticsIn DetailWhether you are an experienced developer or a novice, learning to work with Version Control Systems is a must in the software development world. Git is the most popular tool for that purpose, and GitHub was built around it, leveraging its powers by bringing it to the web.Starting with the basics of creating a repository, you will then learn how to manage the issue tracker, the place where discussions about your project take place. Continuing our journey, we will explore how to use the wiki and write rich documentation that will accompany your project. You will also master organization/team management and some of the features that made GitHub so well known, including pull requests. Next, we will focus on creating simple web pages hosted on GitHub and lastly, we will explore the settings that are configurable for a user and a repository.Style and approachThis book will take you through some of the most important features of one of the most popular tools, GitHub, which is used to bring developers together from all around the world to discover, share, and build better software. At each step of the way, you will learn about important approaches used in GitHub, including creating a repository, managing teams, creating GitHub pages, and watching your repository's web analytics, among others.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is GitHub Essentials an online PDF/ePUB?
Yes, you can access GitHub Essentials by Achilleas Pipinellis in PDF and/or ePUB format, as well as other popular books in Informatik & Webentwicklung. We have over one million books available in our catalogue for you to explore.

Information

Year
2018
ISBN
9781789138467
Edition
2

Collaboration Using the GitHub Workflow

In Chapter 3, Managing Organizations and Teams, we explored how you can create and manage organizations and teams that will further help you in collaborating with others.
GitHub is a great tool for collaboration and, as such, it has come up with a workflow based on the features it provides and the power of Git. It has named it the GitHub workflow (https://guides.github.com/introduction/flow).
In this chapter, we will learn how to work with branches and pull requests, which are the most powerful features of GitHub. Here's what we will cover:
  • Learning about pull requests
  • Peer review and inline comments
  • Merging the pull request
  • Tips and tricks

Learning about pull requests

Pull request is the number one feature in GitHub that made it what it is today. It was introduced in early 2008 and has been used extensively among projects since then.
While everything else can be pretty much disabled in a project's settings (such as issues and the wiki), pull requests are always enabled.

Why pull requests are a powerful asset to work with

Whether you are working on a personal project where you are the sole contributor, or on a big open source project with contributors from all over the globe, working with pull requests will certainly make your life easier.
Think of pull requests like chunks of commits, and the GitHub UI helps you clearly visualize what is about to be merged in the default branch or the branch of your choice. Pull requests are reviewable with an enhanced different view. You can easily revert them with a simple button on GitHub and they can be tested before merging, provided a CI service is enabled in the repository.
CI stands for continuous integration. For more details, you can refer to the applications that GitHub integrates at https://github.com/marketplace/category/continuous-integration.

The connection between branches and pull requests

There is a special connection between branches and pull requests. In this connection, GitHub will automatically show you a button to create a new pull request if you push a new branch in your repository. As we will explore in the following sections, this is tightly coupled to the GitHub workflow, and GitHub uses some special words to describe the from and to branches. As per GitHub's documentation:
The base branch is where you think changes should be applied, the head branch is what you would like to be applied.
So, in GitHub terms, head is your branch, and base is the branch you would like to merge into.

Creating branches directly in a project ā€“ the shared repository model

The shared repository model, as GitHub aptly calls it, is when you push new branches directly to the source repository. From there, you can create a new pull request by comparing between branches, as we will see in the following sections.
Of course, in order to be able to push to a repository, you either have to be the owner or a collaborator; in other words, you must have write access.

Creating branches in your fork ā€“ the fork and pull model

Forked repositories are related to their parent in a way that GitHub uses in order to compare their branches. The fork and pull model is usually used in projects when you do not have write access, but are willing to contribute.
After forking a repository, you push a branch to your fork and then create a pull request in the parent repository, asking its maintainer to merge the changes. This is common practice for contributing to open source projects hosted on GitHub. You will not have access to their repository, but, being open source, you can fork the public repository and work on your own copy.

How to create and submit a pull request

There are quite a few ways to initiate the creation of a pull request, as we will see in the following sections.
The most common one is to push a branch to your repository and let GitHub's UI guide you. Let's explore this option first.

Using the Compare & pull request button

Whenever a new branch is pushed to a repository, GitHub shows a quick button to create a pull request. In reality, you are taken to the compare page, as we will explore in the next section, but some values are already filled out for you.
Let's create, for example, a new branch named add-gitignore where we will add a .gitignore file with the following content:
git checkout -b add-gitignore echo 'password' > .gitignore git add .gitignore git commit -m 'Add .gitignore' git push origin add-gitignore
Next, head over to your repository's main page and you will notice the Compare & pull request button:
From here on, if you hit this button, you will be taken to the compare page. Note that I am pushing to my repository following the shared repository model, so this is how GitHub greets me:
What would happen if I used the fork and pull repository model? For this purpose, I created an...

Table of contents