Git

Distributed version control system

Git Overview

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git was created by Linus Torvalds in 2005 for development of the Linux kernel.

Creator

Linus Torvalds

Initial release

April 7, 2005

Written in

C, Shell, Perl

License

GNU GPL v2

Key Features

Installation & Setup

Installation Steps:

  1. Download the installer from official website
  2. Run the installer with default options (Windows) or use package manager (Linux/macOS)
  3. Configure your identity:
    git config --global user.name "Your Name"
    git config --global user.email "your.email@example.com"
  4. Set up SSH keys for secure authentication with remote repositories

Common Commands:

git init

Initialize a new Git repository.

git clone

Clone an existing repository.

git status

Show the working tree status.

git commit

Record changes to the repository.

Productivity Tips

Aliases

Create shortcuts for common commands in your ~/.gitconfig file:

[alias]
    co = checkout
    br = branch
    ci = commit
    st = status

Interactive Staging

Use git add -p to interactively stage changes.

Rebase vs Merge

Use rebase to maintain linear history, merge to preserve branch topology.

Git Hooks

Use client-side hooks to automate tasks like running tests before commits.

Learning Resources