Learn How to Use GitHub Tutorial
What is GitHub?
Table of Contents
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
A 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?
- In the upper right corner, next to your avatar or identicon, click and then select New repository.
2.Name your repository hello-world
1.
3.Write a short description.
4.Select Initialize this repository with a README.
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-world
1.
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.
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?
- Click the
README.md
file. - Click the pencil icon in the upper right corner of the file view to edit.
- In the editor, write a bit about yourself.
- Write a commit message that describes your changes.
- Click Commit changes button.
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.
How to Merge a Pull Request?
- Click the green Merge pull request button to merge the changes into
main
. - Click Confirm merge.
- Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.
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!!!