The Beginner’s Guide to Version Control with GitHub

Sheikha Hanna Rahman
SLIIT FOSS Community
5 min readMay 15, 2022

For newbies, you’re probably wondering what on earth is Version Controlling — specifically in GitHub is all about. Let’s make the definition simple — Version Control is the practice of keeping ‘versions’ of your code, all in one place, and one of the best ways to do that as a beginner is to use GitHub, a code hosting platform for version control and collaboration.

As a beginner dealing with the basic software demands and programming, you probably might have saved your work in many forms, in different file names and formats on your PC. This could be a very challenging method, with inefficiency and rather hard to find the correct version of your code or project, and sometimes leave you feeling demotivated and uncertain.

Why Version Controlling?

Version Controlling makes this quite easier for you to handle, along with time management, collaboration with teammates, and code merging. Version control is considerably smoother and easier to apply with version control software such as GitHub. Using an online platform to host your files, such as GitHub, ensures that you have an online backup of your work, which is advantageous to both you and your colleagues.

Why GitHub?

For starters, GitHub is one of the most popular version control and collaboration tools any developer can use for free. GitHub makes it easy for you to collaborate with your teammates and get your work done. GitHub also provides guides, documentation, and workshops for a better understanding of their tools, and helps to track changes across your website.

GitHub is also considered a resume for developers: Recruiters can easily look at your profile and all your consistent contributions and check how you solve coding problems and clean code.

Terminology

As a beginner, here are a few terms that you need to know before heading off with GitHub.

  1. Repository: Central location where all the files are being kept. Usually a directory with a set of files.
  2. Master Branch: This is where the most stable code is being placed which is referred to as the production code.
  3. Stage: Mark files for tracking changes.
  4. Commit: Create a snapshot of the changes being made to the files.
  5. Branch: At a specific point, a copy of the master branch is taken. A branch will be used for all feature development and problem fixes. Multiple branches are usually permitted at the same time. Once the feature development is complete, all branches can be merged into the master branch for final approval and testing.
  6. Checkout: Mark/unlock the file for changing.
  7. Merge: Combining branches to update the master branch.
  8. Merge conflict: This occurs when you combine branches with competing commits, and Git requires your assistance in determining which changes to include in the final merge.

Get Started with GitHub!

Photo by Mohammad Rahmani on Unsplash
  1. Create an account with GitHub

Before you begin, you need to create an account with GitHub and configure your profile. You can either view the docs here or create a new account here.

2. Create a new repository

Click on the ‘New’ button under the Repositories tab

Once you’re done setting up your GitHub account, navigate to the Repositories tab and click on the ‘New’ button. You will instantly navigate to the below page:

Create a new repository

A repository stores all of your project’s files as well as the revision history for each file. Within the repository, you can discuss and manage the work of your project. Add a repository name, choose your repository type, and generate a README file if you need to provide information or a summary of what you are going to do.

Once you’re done, you can click on the below button and get started!

3. Make your first commit

A commit is similar to taking a snapshot of all the files in your project at a specific point in time.

When you first set up your new repository, you included a README file. README files are an excellent place to describe your project in greater detail or to include guidance such as how to install or use your project. The contents of your README file are displayed on the home page of your repository by default.

As soon as you create your repository, you will be directed to the main repository page. You can add your README file in the repository for other uses to get a better understanding of what your project solves.

Add a README file

Click on the ‘Add a README’ button and it will navigate to the below screen. Type a concise, meaningful commit note at the bottom of the page that describes the modification you made to the file. In the commit message, you can credit the commit to several authors.

Once you are done, choose whether to add your commit to the current branch or a new branch underneath the commit message fields. If the default branch is your current branch, you should create a new branch for your change and then file a pull request.

Click ‘commit new file’ and you’re done! Your code is ready to be pushed into your brand-new repository. Happy coding!

--

--

Sheikha Hanna Rahman
SLIIT FOSS Community

A bookworm with severe writing block | Technical Blogs | Creative Writing | Fiction 💕