Introduction of Git for Beginners.

Introduction of Git for Beginners.

What is Git?

  • Git is distributed version control framework that is free & open source.
  • It is used for project collaboration & history exploration.
  • It uses cryptographic algorithms to store files & snapshots.

Installation

  • Github for Windows: https://windows.github.com
  • Github for Mac: https://mac.github.com
  • Git for all platforms: https://git-scm.com

Setup

  • git config --global user.name "[firstname lastname]"
  • git config --global user.email "[valid-email]"

Initializing

git init

  • initialize an existing directory as a Git repository.

    git clone [url]

    • retrieve an entire repository from a hosted location via URL.

Staging area

git status

  • Show modified files in working directory, staged for your next commit.

    git add [file]

  • add a file as it looks now to your next commit (stage).

    git commit -m "[descriptive message]"

    • commit your staged content as a new commit snapshot.

Branch

git branch [branch-name]

  • create a new branch at the current commit.

For Sharing

git push

  • Transmit local branch commits to the remote repository branch.

For Tracking path changes

git rm [file]

  • delete the file from project & stage the removal for commit.

    git mv [existing-path] [new-path]

  • change an existing file path & stage the move.