Git And GitHub: A Concise Roadmap On How They Both Work

Introduction

Git is a version control system designed to help users keep track of changes to files within their projects. Compared to other version control systems, Git is more reliable, has more accessible syntax, has free and open-source syntax, is faster and performs better. It is predominantly used via the command line and developers tend to find Git commands and syntax easy to learn.

GitHub is another service commonly used among developers. It is a cloud based hosting service that lets you manage Git repositories from a user interface. It incorporates Git version control system and extends this by providing its own features on top. GitHub is like a social network for developers, it enables them to interact and also work as a team to achieve their desired goals. In this article, we will learn about how they work individually and also get more insight into certain terms used in their workspace.

Firstly, let us learn some common git commands along with their descriptions and examples:

Common Git Commands And Their Descriptions:

  • git init: Initialises a new repository in the current directory.
  • git status: checks the status of your file, shows the status of changes as untracked , modified or staged.
  • git add <file>: Adds specified files to the staging area.
  • git add . : Adds all files to the staging area.
  • git commit -m “Your commit message”: This commits messages, records the changes in the local repository with a message describing the changes.
  • git log: shows the commit history for the repository.
  • git branch <branch-name>: create a new branch.
  • git checkout <branch-name> : switches to the specified branch.
  • git checkout -b <branch-name> : creates and switches to the new branch.
  • git merge <branch-name> : merges the specified branch into the current branch.
  • git branch -d <branch-name> : deletes the specified branch.
  • git push origin <branch-name> : pushes changes from the local repository to the remote repository.
  • git pull origin <branch-name> : fetches and merges changes from the remote repository to the local repository.

Let us now learn what some of the terms mentioned above mean:

What is a Repository?

A repository often abbreviated as a “repo” is a data structure used to store metadata for a set of files or directory structure. The key concepts or purpose of a repository include storage in the sense that it stores files, the history of changes made to files and information about these changes, version control meaning it keeps track of every change made to files and directories it contains which includes who made the changes, when they were made and exactly what changes was made and lastly, it aids collaborations by facilitating collaboration among multiple developers.

Types of Repository

Local Repository: This is a repository stored on a user’s local machine where user’s can make changes, commit them and perform various version control operations locally.

Remote Repository: This is a repository hosted on a server accessible over a network (usually the internet) that can be accessed by multiple users. Services like GitHub, GitLab and Bitbucket provide hosting for remote repositories thus enabling collaboration.

Olamide Ayeni

Share
Published by
Olamide Ayeni

Recent Posts

10 Reasons Why You Should Learn Python In 2025.

Introduction In the fast paced world of technology, learning a versatile and high-in-demand programming language…

3 days ago

Building And Implementing A Blog App Using Django: User Authentication

Introduction User Authentication policy is a very crucial process for every application and organization. It…

3 weeks ago

Building And Implementing A Blog App Using Django: Adding Forms

Introduction In previous articles, we have learnt about Django, how it works and how we…

1 month ago

Building And Implementing A Blog App Using The Django Framework

Introduction In this article, we shall learn how to build and implement a blog app.…

1 month ago

Building And Implementing A Message Board App Using Django

Introduction In this article, we shall use a database for the first time to build…

2 months ago

Building And Implementing A Two Paged Web Application Using Django

Introduction In this article, we will build a pages app that has a homepage and…

2 months ago