Skip to main content

Git for Beginners: Basics and Essential Commands

Published 2 min readMarkdown

What is the Git?

Git is the version control system. Git is the tool that help you track changes in your code. it track every little change or update in your code you make. You can always look back at previous version of your code if needed.

it was created by Linus Torvalds in 2005 for the development of linux kernel .

Feature of Git

  1. Version control system : git track every change in your project file you make. You can go back you can go back on previous code id requirement.

  2. Repositories : git repository is the directory where every thing your project store and mange. There are two main types.

    1. Local Repository : this is the copy of your repository that store in your computer.

    2. Remote Repository : this is store on server, where you and other can share and work on same project.

  3. Commits : Every time you make changes and save them in Git it called as commits. The repository keep track your every commit

Reason to choose Git

  • Distributed system : Every developer has a complete local copy of the project, allowing work and increase resilience.

  • Performance : Git is faster and efficient to handling large project.

  • Branching and Merging : Git’s branching and easy merging facilitate parallel development and featuring isolation.

Terminologies of Git

  • Repository (Repo) : Where git store the all project files and store their history.

  • Working directory : Your current working folder that you making changes.

Common Git commands

  • Setup

    1. git config —global user.name “[firstname lastname]”

set a name that identifiable for credit when review versoin history

  1. git config —global user.email ‘[valid email]”

    set an email address

  2. git config —global color.ui auto

    set automatic command line coloring for git easy reviewing

  • Setup and Init

    1. git init

      initialize an existing directory as git repository

  • Stage and Status

    1. git status

      show modified file in working directory, staged for your next commit

    2. git [add]

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

    3. git commit -m “[descriptive message]”

      commit your stage content as a new commit snapshot

No comments yet. Be the first to comment.