Git tutorial for beginners!

Chanida Limthamprasert
4 min readFeb 28, 2021

Have you ever been confused about all the git stuff such as push, pull, commit, and other functions?

I’m sure almost every git user (at least me) had been puzzled by them at the beginning. Today I’ll help you to learn about some of the git functions step-by-step. I promise you, this stuff is not difficult to understand. Please don’t lose track!

Fork a git repository

The short definition of fork has been explained in GitHub Docs as below:

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

By the way, to fork a repository is to copy it and let you have that repository to yourself so you can change anything you want such as edit, delete files, upload files, etc.

When you want to fork a repository, you can click on the fork button on the top right corner.

After that, you’ll see a copy of the repository on your account’s repository page. Now you can change anything you want to your forked repository.

Create a branch

If you want to add a new branch to your repository so you can isolate development work without affecting other branches in the repository, you can easily click on the drop-down at the main branch and if you type the existing branch name it will switch to that branch. In the case that you want to create a new one, you can name the new repository as you want and click create branch and that’s it!

Upload a new file

To upload a new file, you can choose to create a new one or upload your existing file.

After click upload files, you can drag your file here or choose from the file’s location. Click on commit changes and your file will appear at your branch.

Commit the changes

You will frequently see the commit change function in Git. It is basically as same as “OK, save the changes” If you edit/upload/delete a file and you want to save the changes you’ve made, you need to click on commit changes to apply the changes.

Push local file to the repository

Push is used to transfer the commit, which is made on your computer to a remote repository.

This action is easier to do in GitHub Desktop than using the command line.

Open GitHub Desktop and clone a repository.

After the repository was cloned, the clone folder will automatically create on your computer. You can find it in the GitHub folder. You can copy files from your computer into the clone folder.

Pull request

If you work with others on the same repository, Pull requests can let you tell your collaborators about changes you’ve pushed to a branch in a repository.

When you’re done editing changes and you want to apply the changes to the other branch, you need to click Pull request at the top left.

Choose the branch you want to pull and click Create pull request at the bottom left corner.

Your changes will be merged into the branch after the pull request is approved and closed.

Hope this would not make you more confused about GitHub!

--

--