Skip to main content

Command Palette

Search for a command to run...

GIT - Overview

Published
2 min read
GIT - Overview

What is GIT?

Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development.

The four areas of Git:

  • Working Area / Project repository -> It’s a place where we keep our current files on which we are about to work.

  • Repository -> Contains entire history of Project

  • Index Area -> Intermediate area, a place where we put our files before commit

  • Stash -> Temporary storage area

GIT Commands:

init: This command initializes the new repository

add: This command add the changes from working tree to the staging area

  • git add comes with 4 major options for adding changes

    • git add

    • git add . adding all the changes relative to current directory

    • git add -A add all the changes

    • git add -u add only modified files

status: This command shows the status of working tree and changes

commit: This command commits the changes from staging area to working tree

log: This command shows the commits done in local repo

checkout:

  • Add the changes to the staging area and try to unstage

    Preview

  • To unstage the popular option is git restore --staged

  • To remove the changes from working tree

    modified: git restore

    untracked:

    delete normally

    git clean -fd .

      • Preview

FF Merge
Fast-forward merges move your main branch's tip forward to the end of your feature branch. This keeps all commits created in your feature branch sequential while integrating them neatly back into your main branch.

Three-Way Merge

GIT functions:

  • git diff ..

  • git diff ^..

  • HEAD~5

  • HEAD~1

  • How to find commits between two dates

      git log --oneline --since="1/1/2014" --until="30/6/2014"