Git and Git Hub Commands

·

3 min read

Software developers tend to work in packs. We pool our creativity (and our code) to build software and our strength in numbers helps reduce the risk of errors. The more people who check code and scan for bugs, the cleaner our final product will be.

However, this places a premium on effective communication. We will end up accessing, reading, writing and changing the same files over and over again, and it’s vital we keep duplication of work to a minimum.

A Version Control System(VCS) is great for this. It’s a change management system that records all the changes to files and folders over a period of time. You can go back in history to fetch a specific version of the change you’re interested in, and it allows multiple people to collaborate on the same project without getting in each other’s way (a bit like Google Docs and Google Sheets allow us to collaborate on written documents).

Git is the most popular, most-widely used example of a VCS; today, in fact it’s used by over 90% of developers. However many people don’t know all the commands that git offers, so they may be missing out on some of its most powerful and beneficial features.

But fear not, coding comrades. In this post, we’re going to take you through the best commands, starting right from the very beginning.

Git and GitHub

Git is a popular version control system. It was created by Linus Torvalds in 2005, and has been maintained by Junio Hamano since then.

It is used for:

  • Tracking code changes

  • Tracking who made changes

  • Coding collaboration

What does Git do?

  • Manage projects with Repositories

  • Clone a project to work on a local copy

  • Control and track changes with Staging and Committing

  • Branch and Merge to allow for work on different parts and versions of a project

  • Pull the latest version of the project to a local copy

  • Push local updates to the main project

Working with Git

  • Initialize Git on a folder, making it a Repository

  • Git now creates a hidden folder to keep track of changes in that folder

  • When a file is changed, added or deleted, it is considered modified

  • You select the modified files you want to Stage

  • The Staged files are Committed, which prompts Git to store a permanent snapshot of the files

  • Git allows you to see the full history of every commit.

  • You can revert back to any previous commit.

  • Git does not store a separate copy of every file in every commit, but keeps track of changes made in each commit!

Change Platform:


GitHub

Bitbucket

GitLab

Why Git?

  • Over 70% of developers use Git!

  • Developers can work together from anywhere in the world.

  • Developers can see the full history of the project.

  • Developers can revert to earlier versions of a project.

What is GitHub?

  • Git is not the same as GitHub.

  • GitHub makes tools that use Git.

  • GitHub is the largest host of source code in the world, and has been owned by Microsoft since 2018.

  • In this tutorial, we will focus on using Git with GitHub.

Git Commands

follow on more updates

Linked In

Twitter

Did you find this article valuable?

Support Gokil p by becoming a sponsor. Any amount is appreciated!