Category Archives: SCM

Gerrit – Web Based Code Review and Project Management for Git Based Projects

Gerrit Overview

  • Web based code review and project management for Git based project
  • Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer
  • Gerrit simplifies Git based project maintainer-ship by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer. This functionality enables a more centralized usage of Git.
  • Gerrit is intended to provide a lightweight framework for reviewing every commit before it is accepted into the code base.
  • Gerrit is firstly a staging area where changes can be checked over before becoming a part of the code base.

Gerrit  in central Git Repo

Resources:

Git Commands | Training | Basics | Videos | Tutorials

Introduction to Git & Git Commands

git

What is Git?

  • Keeps track of changes (text especially)
  • Version control system (VCS)
  • Source Code Management (SCM)

Git is distributed version control system:

  • Different users maintain their own repository instead of working from central repository
  • Track changes not version (change sets or patches)
  • Change sets can be exchanged between repositories ( merge changes or apply patches)
  • No need to communicate with central server when working on a local copy (no network access is required).

Installing git Windows/Mac/Linux

Git configuration

Git can be configured at three levels:

  1. system
  2. user
  3. project

1. System

/etc/gitconfig
Program Files\Git\etc\gitconfig

git config --system

2. User

~/.gitconfig
$HOME\.gitconfig

git config --global
manvirbasra->$git config --global user.name "Manvir Basra"
manvirbasra->$git config --global user.email "manvirbasra@gmail.com"
manvirbasra->$git config --list
user.name=Manvir Basra
user.email=manvirbasra@gmail.com
manvirbasra->$cd ~
manvirbasra->$cat .gitconfig
[user]
	name = Manvir Basra
	email = manvirbasra@gmail.com

3. Project

manvirs_project/.git/config

git config

Git Three Tier Architecture

git three tier architecture

Git Help Commands

manvirbasra->$git help
manvirbasra->$git help log
:f - forward
:b - backward
:q - quit

Initializing a git repo

  • This command creates a .git folder inside the current directory which contains all the tracking information.
manvirbasra->$git init
  • To add everything in the working directory to staging
git add .
  • To commit
git commit -m "commit message"
  • Git Logs
git log --grep="bug fix"
git log -n 2
git log --since=2014-08-02
git log --until=2014-08-02
git log --author="Manvir"
  • HEAD

To show current brach’s head pointing to:

git log HEAD or
cat HEAD
  • To Check Git Status

status between repository, staging directory and working directory

$git status

Resources