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

Building A Message Board App With Django

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

6 days ago

Building A Two Paged Web Application Using Django

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

2 weeks ago

Creating Your First App In Django

When you say you want to use Django, it means you want to build a…

3 weeks ago

Creating Your First Project In Django?

Introduction Django is a high level Python framework that encourages rapid development and clean, pragmatic…

4 weeks ago

Django Setup For Windows

Django Setup To work with Django, we have to install Django first. Now when you…

4 weeks ago

Why Choose Django When There Are Other Frameworks For Python?

Why choose Django when you have other frameworks for Python? Django, Django, Django. When it…

1 month ago