Using GitHub without the command line

By Craig Lockwoodx May 2017 Tutorials

If the sight of a final or command line frightens you, this guide by Craig Lockwood will teach you to use GitHub to collaborate with others without ever touching the command line

This guide volition teach you how to:

  • Create an account on GitHub.com
  • Create a repository
  • Manage and create branches
  • Commit changes to a repository
  • Open up and merge pull requests
  • Create mentions and discussion

Introduction

GitHub is now the largest online collection of collaborative works that exists in the world. Developers, engineers and designers all over the earth are using GitHub to interact and share code with others.

Once GitHub has become a part of your working routine, you will wonder how you managed without it. Notwithstanding, there is quite a steep learning curve to using GitHub. There are hundreds of tutorials on the web to help beginners get to grips with GitHub, simply most require all-encompassing knowledge of using the command line. There is, however, a way of using the almost normally used features without ever having to open a command line.

What is GitHub?

Before we learn about GitHub, it is important to understand what Git is.

Initially developed in 2005, Git has now been go the almost pop pick amongst developers and engineers to manage lawmaking. Git is what's known every bit a distributed version command system. That ways when you lot clone a repository you accept a complete copy of the unabridged repository including its history. Think of a repository as a database where records of all changes to your files are kept. A distributed system similar Git means that anyone who has a re-create of a repository on a local figurer essentially has a complete backup. Git has gained popularity over recent years for this and a number of other reasons.

A local repository tracking our commits is fine, just it's non a fail-safe and doesn't lend itself to collaboration. This where services similar GitHub come up in.

Tip: GitHub is non unique. At that place are many alternatives, such as Bitbucket, Beanstalk and Codebase. GitHub, however, is a very popular service and offers a complimentary account, which makes information technology an ideal choice for us to use in this guide.

Pace 1: Create a GitHub account

Creating an account on GitHub is straightforward, best of all, GitHub is free to utilize for public and open source projects. If y'all would like to keep your projects (repositories) private and not publicly bachelor at that place are paid plans - in this instance, a gratis account will serve our purposes just fine.

Visit GitHub.com and pick a username. Once yous have submitted an email address and chosen a countersign your business relationship volition be agile - you are set up to become.

Github

Step 2: Create a new repository

A repository (sometimes called a repo) is a container used to organise a project. Repositories contain all of the folders and files needed for your project. This tin include text files, images, videos, or any other kind of file you could think of.

For the purpose of this walkthrough, nosotros will create a repository calledExamination-REPO.

  1. Click the+ sign next to your avatar in the top right corner and selectNew repository.
  2. Name your repositoryExam-REPO.
  3. Write a short clarification of your project.
  4. SelectPublic.
  5. SelectInitialize this repository with a README.
  6. ClickCreate repository.
Create Repo

A repository calledTEST-REPO will then be created and you lot will be taken to the repository page. Note that the URL structure for the repository will existgithub.com/business relationship-name/repository-name.

Here y'all will come across a list of all the files associated with this repository along with a commit message (more of this later on) and a date/time of when that file was last changed. In our case, we will simply encounter the automobile-generatedREADME.md file.

Test Repo

Step 3: Create a new co-operative

Branching involves diverging from your main line of development and standing to piece of work without affecting that main line. When you initialize a new Git repository, by default you lot're checked into themaster branch. Branching can be a great way of working on a feature of a project without affecting theprimary code. When you have finished working on your new feature you tin then merge your new code into the main codebase, theprimary branch.

Branch

The diagram above shows a branch from themaster co-operative calledevolution. After multiple changes, thedevelopment branch is then merged dorsum into themasterco-operative.

Let'due south create a new co-operative calleddevelopment.

  1. Select the drop down at the superlative of the file list that saysbranch: <strong>primary</strong>.
  2. Create a new branch name, is this instance, telephone call itdevelopment.
  3. Select the blueCreate branchbox.

At this signal, you should have two branches, master and development. Both branches will be identical as we have all the same to makes any changes. You can check in and out of the two branches past selecting from thebranch driblet downward list.

Branches

Stride four: Make changes and commit them to a repository

Before nosotros get whatsoever further, make certain yous have selected theevolution branch as we are most to make some changes. When a change is fabricated, these changes are saved ascommits. Each fourth dimension you commit it is a good idea to add a short commit message, this creates a readable history of the project and allows others who may exist contributing to the projection to understand what is going on at a glance.

Allow's start past making some changes to the README.physician file.

  1. Select theREADME.me file.
  2. Select the pencil icon in the top right of the corner of the file viewer.
  3. In the edit window, blazon a few lines of text - anything will do (you can style the text if yous wish using the Markdown syntax)
  4. Create a commit message where it saysAdd an optional extended description....
  5. Select theCommit changes button.
Commit Changes

The changes only made to theREADME.md file on thedevelopment branch will but be visible on thedevelopment branch, theprimary co-operative will still testify the old, unchanged version of theREADME.me file.

Step 5: Pull requests and merging

And so now we have two branches, each slightly unlike every bit thedevelopment branch has had a change which we have then committed. To keep themaster co-operative up to date, we volition now expect topull whatever updates into thechief branch - this is done using aPull Request.

Pull Requests are what makes GitHub such a swell tool for collaboration. At this point nosotros have made changes to a file ourselves, just in theory, everyone could make these changes and and so ask for a Pull Request, assuasive their edits to be merged into a project. A Pull Request needs to be reviewed before the changes are merged, this prevents bad work from entering a co-operative.

A Pull Request will highlight the differences (often calledDiffs) in the content between branches. Changes can be additions or subtraction to the content. Additions are highlighted in dark-green whilst subtractions are highlighted in ruddy.

And so let'southward open up a Pull Request for the changes that we made to theREADEME.md file.

  • Select thePull Requests tab - simply under the repository title.
  • Select the greenNew pull request button.
New Pull Request
  • Select the best co-operativemaster to compare with the branch which includes the changes fabricated, in this casedevelopment.
Compare
  • If y'all are happy that you wish to submit these changes, select the greenCreate Pull Request button.
  • Just as you did when yous created a commit message before, write a clarification of your changes.
  • Select theCreate pull request.

The Pull Request is now open. This means that the changes are prepare to be merged into themain branch.

Open Request

The final pace to merging the differences between branches is to merge the Pull Request. To do this, select the greenMerge pull request.

Step six: Create mentions and discussion

We mentioned earlier that also as an excellent platform for keeping track of versions of your work, GitHub is also great at collaboration. Thankfully, Github has a great mechanism for discussion in the course ofmentions.

When you brand a Pull Request, you may want to brand a note to a particular collaborator. By using the@ symbol followed by a GitHub username, you tin send a message to a collaborator, colleague, or anybody inside the GitHub community. This feature is corking for flagging issues, errors or areas for farther word.

Congratulations, you at present know the basics of using GitHub

You have now learnt to employ GitHub for collaboration with others. There are plenty of farther resource should you wish to acquire more than about using GitHub. Some of our favourites are listed below:

  • Git for humans
  • GitHub flow guide
  • GitHub for beginners