Git and GitHub

Backend Engineering

Git and GitHub

Introducing Git and GitHub

Introducing Git and GitHub

What is Git

Git is a distributed version control system (DVCS) created by Linus Torvalds in 2005 to manage Linux kernel development. It allows multiple developers to work on a project simultaneously without overwriting each other's changes. Git tracks changes to files and directories over time, enabling users to revert to previous versions, compare changes, and collaborate efficiently.

Quick History of Git

Before Git, the Linux kernel project relied on a proprietary DVCS called BitKeeper. In 2005, the relationship between the Linux kernel community and BitKeeper's developers deteriorated, leading Linus Torvalds to develop Git. Git was designed to handle the high velocity and complexity of Linux kernel development. It quickly gained popularity and has since become the standard for version control in the software industry.

Who uses Git

Git is used by a vast range of developers and organizations, from individual open-source contributors to large enterprises. Notable users include:

  • Software Developers: To track changes, collaborate, and manage codebases.

  • DevOps Teams: For continuous integration and deployment (CI/CD) pipelines.

  • Project Managers: To oversee project progress and manage feature development.

  • Designers and Writers: To version control digital assets and documents.

Git vs. GitHub: What's the Difference

  • Git: Git is a version control system that runs locally on your machine. It enables you to track changes, revert to previous states, and branch out to experiment without affecting the main project.

  • GitHub is a web-based platform that hosts Git repositories. It adds a social collaboration layer with features such as pull requests, issue tracking, and project management tools. GitHub facilitates remote collaboration, making sharing your work with others and contributing to public repositories easy.

Installation and Setup

Before you can start using Git, install it on your local machine and configure some basic settings. This section will guide you through installing different operating systems and initial setup.

Installing Git on Windows

  1. Download Git:

    • Visit the official Git website: Git for Windows

    • Click on the download link to get the latest version of Git for Windows.

  2. Run the Installer:

    • Locate the downloaded .exe file and run it.

    • Follow the setup wizard. You can generally accept the default settings. However, there are a few steps worth noting:

      • Adjusting your PATH environment: Ensure the option "Git from the command line and 3rd-party software" is selected.

      • Choosing the SSH executable: Use the bundled OpenSSH.

      • Configuring the line ending conversions: Choose "Checkout Windows-style, commit Unix-style line endings" for the best compatibility.

  3. Verify the Installation:

    • Open a command prompt (CMD) or PowerShell.

    • Type git --version and press Enter. If installed correctly, you will see the version of Git that was installed.

Installing Git on Mac

  1. Using Homebrew:

    • If you have Homebrew installed, you can install Git by opening the Terminal and typing:

      brew install git
      
  2. Using the Git Installer:

    • Alternatively, you can download the Git installer from the official Git website: Git for Mac

    • Run the downloaded .dmg file and follow the installation instructions.

  3. Verify the Installation:

    • Open the Terminal.

    • Type git --version and press Enter. If installed correctly, you will see the version of Git that was installed.

Configuring Your Name and Email

Once Git is installed, you need to configure your user information, which will be used for all your commits. This step is essential because Git attaches this information to each commit you make.

  1. Open Your Command Line Interface:

    • On Windows, open Command Prompt or PowerShell.

    • On Mac, open Terminal.

  2. Set Your Name:

    • Type the following command and press Enter:

      git config --global user.name "Your Name"
      
    • Replace "Your Name" with your actual name.

  3. Set Your Email:

  4. Verify Configuration:

    • To verify that your configuration is correct, type:

      git config --global --list
      
    • You should see your name and email listed among other configurations like this:

      Untitled (45).png

By following these steps, you will have Git installed and configured on your machine, ready for use in version control of your projects. Next, we'll dive into the basics of Git to familiarize you with how it works.

Whenever you're ready

There are 4 ways we can help you become a great backend engineer:

The MB Platform

Join 1000+ backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learnings and set schedules, and solve backend engineering tasks, exercises, and challenges.

The MB Academy

The “MB Academy” is a 6-month intensive Advanced Backend Engineering BootCamp to produce great backend engineers.

Join Backend Weekly

If you like post like this, you will absolutely enjoy our exclusive weekly newsletter, Sharing exclusive backend engineering resources to help you become a great Backend Engineer.

Get Backend Jobs

Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board