Getting started with Git

What is Git?

  • Git is a distributed version-control system for tracking changes in source code during software development. 
  • Git comes with built-in GUI tools for committing (git-gui) and browsing (gitk), but there are several third-party tools for users looking for platform-specific experience.
  • For list of thrid-party Git GUI tools, visit – https://git-scm.com/downloads/guis

Git GUI Clients

  • One of the popular free Git GUI Client is Sourcetree. You can download Sourcetree from https://www.sourcetreeapp.com/
  • You can extend GitHub workflow beyond your browser with GitHub Desktop. You can download from https://desktop.github.com/

Code Hosting Platforms

  • There are many source code repository hosting platforms for git, namely GitHub, BitBucket, GitLab etc.,
    • GitHub is a code hosting platform for version control and collaboration.
    • Bitbucket is more than just Git code management. Bitbucket gives teams one place to plan projects, collaborate on code, test, and deploy.
    • GitLab is a complete DevOps platform, delivered as a single application.

Installing Git

  • Download and Install the latest Git Version 2.23.0 for Windows from https://git-scm.com/downloads
  • Once the Git is installed, you can start working with Git Commands from Windows Command Prompt or from Git GUI or Git Bash.
  • By default, Git is installed in the following path in Windows, C:\Program Files\Git

Getting started with Git Setup for the first time

  • You need to do few things to customize your Git environment and need to do only once on any given computer. You can also change them at any time by running through the commands again.
  • Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates.
  • On Windows systems, Git looks for the .gitconfig file in the $HOME directory (C:\Users\$USER for most people). In my system, it is located at C:\Users\Girish\.gitconfig

You can view all of your settings using

$ git config --list --show-origin

The first thing you should do when you install Git is to set your user name and email address, because every Git commit uses this information.

$ git config --global user.name "Girish"
$ git config --global user.email girish@example.com

If you want to check your configuration settings, you can use git config --list command to list all the settings

$ git config --list

You can also check to get the specific key’s value is by typing git config <Key>

$ git config user.name
Girish

Getting Help

If you need help while using Git, you can get the comprehensive manual page (manpage) help by typing git help <verb>

$ git help config

if you don’t need the manpage help, but just need a quick help on the available options for a Git command, you can use -h or –help options

$ git init -h

References

  • https://git-scm.com

Learn more about Git Commands, using Sourcetree and GitHub in the next upcoming Blog Articles.

Happy Learning!