Git, GitHub, and Version Control

Muktida
3 min readJul 30, 2021

--

A complete guide to get going with Git, GitHub, and understanding Version Control.

Git & GitHub: Git and GitHub are the same things, except that Git uses commands and everything happens locally and is updated into your GitHub account. Everything you can do on Git can be done directly on GitHub.

Version Control : Version control systems start with a base version of the document and then save just the changes you made at each step of the way.

It allows you to decide which changes make up the next version, called a commit, and keeps useful metadata about them. The complete history of commits for a particular project and their metadata make up a repository. Repositories can be kept in sync across different computers facilitating also collaboration among different people. One really useful feature of version control is that if something goes wrong, you can start from some earlier version of the file when everything was still working. You can also compare the differences between versions and see what has changed.

If you don’t have a GitHub account then make one.

Creating new Repo on GitHub:

Open your account, click the plus button on the top right corner of your GitHub account and click “New repository”.

Creating new Repository

Now, Name your repository, add the description if you want, click on the boxes to create readme file , license and gitignore , and then click on create repository. Your repo will be created and can be access through your GitHub account.

Readme.md : A Readme file is a file that describes the purpose of the repository and gives hints on what the code does, how to compile/use it, etc. The . md extension stands for Markdown, which is a type of file that is both readable in plain text, but can also be easily converted to HTML to display special elements.

Gitignore : This is useful when you have personal API Keys, Tokens, Passwords etc., and you don’t want to upload them on GitHub as other people can easily see them. Gitignore is a feature in Git that can allow you to prevent committing specific files

Create a gitignore file, and put in all the files we don't need to show others. Now in the gitignore file, we write down the names of the files we want to ignore.

Forking a Repository :

Forking in GitHub is a process of creating a copy of a complete repository to the user’s GitHub Account from another account. If you want to work in a team and you need to collaborate with your team members. But you are not allowed to do any commits in their repo then forking can be used you can simply create the exact replica of the project and can commit changes to it and push it back to their repo.

In GitHub, navigate to the repository to be forked and select “Fork” on the upper right. This creates a copy of the repository for you on GitHub.

Pull Requests :

A Pull Request is like a suggestion or a branch created by another user. If the owner is OK with the changes, they accept the Request and merge it with their own branch. To create a Pull Request, you have to go to the Pull Request tab and create one from there.

  • Create a New Branch
  • Make Changes Locally
  • Update Local Repository
  • Create Pull Request

Creating or Open a pull request :

Select your branch in GitHub. Select “New pull request”.

You can enter details about the changes you are suggesting. You can also select a branch to send the request to, if it’s not the master branch.

If you’re satisfied and ready, select “Create pull request” at the bottom.

--

--

Muktida

I understand having a healthy balance between perfectionism and pragmatism. One thing I try to live by, is to keep things as simple as possible.