The Beginner’s Guide to Git, GitHub and Netlify

Blog , August 24, 2021

What is Git?

Git is a free, open-source version control software. It was created by Linus Torvalds in 2005. This tool is a version control system that was initially developed to work with several developers on the Linux kernel. Git can be used to store content — it is mostly used to store code due to the other features it provides.

Real life projects generally have multiple developers working in parallel. So a version control system like Git is needed to ensure there are no code conflicts between the developers. A version control system allows developers to revert and go back to an older version of the code. A branch system in Git allows developers to work individually on a task.

Git Repositories

If we want to start using Git, we need to know where to host our repositories.

Repository: a project that contains multiple files. In our case a repository will contain code-base files.

There are two hosting platforms to host our repositories.

  1. Online (On the cloud)
  2. Offline (Self-installed on your server)

Before using Git & GitHub we should know why we need it?

  1. It makes it easy to contribute to your open source projects: If you want to contribute, you just fork a project, make your changes and then send them a pull request.
  2. Documentation: Making documentation enables people to learn about a project.
  3. Track changes in your code across versions: When multiple people collaborate on a project, it’s hard to keep track — who changed what, when, and where those files are stored. GitHub takes care of this problem by keeping track of all the changes that have been pushed to the repository. You can have a version history of your code so that previous versions are not lost with every iteration. It’s easy to come back to the previous version and contribute your work.
  4. Showcase your work

Working with GitHub projects

We’ll work with GitHub projects in two ways.

  1. First creating the repository , clone it to PC and work on it
  2. Type 1 is about create a totally fresh repository on GitHub, clone it to our computer, work on our project and push it back.

  3. Work on your project locally then creating the repository on GitHub and pushing it to remote.
  4. Type 2 is about make a fresh repository from an existing folder on our computer and send that to GitHub because a lot of cases you might actually have already made something on your computer that you want suddenly turn into a repository on GitHub.

# Pulling is the act of receiving from GitHub. Pushing is the act of sending to GitHub.

GitHub Desktop

Once you have your GitHub account set up, you are ready to install GitHub Desktop. In your browser: Open a new browser tab. Navigate to desktop.github.com Download GitHub Desktop. Once installed, open the GitHub Desktop application. Click “Sign in to GitHub.com” and sign in using your GitHub username and password. Click “Finish” on the next screen. You’re now ready to start using GitHub Desktop!

Create a Repository in GitHub Desktop

To create a new repository in GitHub Desktop, go to File and then click "New Repository"

  • name the repository
  • Set the local path
  • click “Create Repository.”

GitHub Desktop - Publish Repository

On the top bar, notice that our current repository is shown. Next to that, our current branch, the default branch, is shown. This repository is currently available only on our local machine. To publish it to GitHub, let’s click “Publish repository.” Now when you navigate to your GitHub profile on github.com, you should see your newly created repository listed there. To work on this Repository: Click Open in Visual Studio Code/preferred text or code editor. Start doing your codes here.

Commit in GitHub Desktop

A commit tells Git that you made some changes to files in your repository and you want to record those changes. To make our first commit To commit the changes, we should first write a commit message on the bottom left of the screen. When we’re ready to commit, we can simply click “Commit to main.” Your commit is currently local to your computer. If you want the changes to to show on GitHub, you must click “Push origin” on the next screen.

Hosting on Netlify:

  • Login or signUp
  • Add Your New Site : Click "New site from Git"
  • Link to Your GitHub : Choose the Git provider where your site’s source code is hosted.
  • Authorize Netlify: A page for login to Github will popup. Just give the acess by logging in.
  • Pick a Repository
  • Configure Your Settings
  • Build Your Site : click the Build your site button to continue.
  • Your site is hosted with temporary name.
  • You can change the domain name by clicking Domain setting ->In custom domain Click "Edit Site name"
  • Done !!

Thank you everyone for reading. I just explained the basics of Git, GitHub and how to deploy on Netlify. I strongly encourage you guys to read more related articles on Git and GitHub. I hope this blog helped you all. Thank you.