How to Use GitHub Tutorial

Learn How to Use GitHub Tutorial

What is GitHub?

GitHub is a code hosting platform for version control and collaboration.

The GitHub allows users of the platform to work on various projects together from anywhere.

The four important features need to be learnt in order to use Git-hub are:

Repositories

Branches 

Commits

Pull Requests

First lets see

What is a Repository?

As per GitHub

repository is usually used to organize a single project.

Repositories can contain folders and files, images, videos, spreadsheets, and data sets – anything your project needs.

How to create a Repository?

  1. In the upper right corner, next to your avatar or identicon, click  and then select New repository.
Create a repository

2.Name your repository hello-world1.

3.Write a short description.

4.Select Initialize this repository with a README.

create a repository

The second main feature to learn is branching

What is Branching?

Branching is the way to work on different versions of a repository at one time

By default your repository has one branch named main which is considered to be the definitive branch. The branches are used to experiment and make edits before committing them to main.

Simply Put, You create a copy of the main add some change some changes and if the proposed changes are good, they will be added to the main.

How To create a new branch?

1.Go to your new repository hello-world1.

2.Click the drop down at the top of the file list that says branch: main.

3.Type a branch name, , into the new branch text box.

4.Select the blue Create branch box or hit “Enter” on your keyboard.

Braching in github

What is a Commit?

According to Github,

On GitHub, saved changes are called commits. Each commit has an associated commit message, which is a description explaining why a particular change was made. Commit messages capture the history of your changes, so other contributors can understand what you’ve done and why.

How to Make and commit changes?

  1. Click the README.md file.
  2. Click the  pencil icon in the upper right corner of the file view to edit.
  3. In the editor, write a bit about yourself.
  4. Write a commit message that describes your changes.
  5. Click Commit changes button.
Commit in github
commit in github

What is a Pull Request?

According to GitHub,

Pull Requests are the heart of collaboration on GitHub. When you open a pull request, you’re proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches. The changes, additions, and subtractions are shown in green and red.

Pull request
Pull request creation

How to Merge a Pull Request?

  1. Click the green Merge pull request button to merge the changes into main.
  2. Click Confirm merge.
  3. Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.
Merge pull request
Merge a pull request

Now you can

  • Create an open source repository
  • Start and manage a new branch
  • Change a file and commit those changes to GitHub
  • Open and merge a Pull Request

Happy Learning!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!