Skip to main content

Command Palette

Search for a command to run...

Git for Beginners: Basics and Essential Commands

Published
β€’2 min readβ€’View as Markdown
Git for Beginners: Basics and Essential Commands
D

Computer Engineering student | Full-Stack Developer (in progress) | DSA in C++ | AI-era Tech Explorer πŸš€ Building skills, mindset, and systems to create impactful technology.

What is Git?

\= Git is a Version Control System (VCS). It helps you track your code changes and save versions of your project.
Git mostly works on your local system and you use it from terminal.


Why Git is Used?

\= Git is used to:

  • track code changes (who changed what and when)

  • work in a team without messing code

  • save project history safely

  • go back to older version if something breaks


Git Basics and Core Terminologies?

\= Git Basics

  • Git: tool to manage version history

  • Repository (Repo): a project folder tracked by Git

  • Local Repository: repo on your laptop/pc

  • Remote Repository: repo online (GitHub, GitLab)

Core Terms:

  • Commit: saved snapshot of changes

  • Branch: separate line of work

  • Main/Master: main branch of project

  • Clone: copy remote repo to local

  • Pull: take latest code from remote to local

  • Push: send local commits to remote

  • Merge: combine two branches

  • Checkout/Switch: move between branches

  • Staging Area: area before commit (git add)

  • HEAD: points to your current commit

  • Conflict: when Git can’t auto merge changes


Common Git Commands?

\= Repository Setup

  • git init β†’ start git in a folder

  • git clone <url> β†’ copy a remote repo

\= Daily Workflow

  • git status β†’ check file status

  • git add <file> / git add . β†’ stage changes

  • git commit -m "message" β†’ save changes

  • git log β†’ see commit history

\= Remote (GitHub) Commands

  • git remote -v β†’ view remote URLs

  • git push β†’ upload commits to GitHub

  • git pull β†’ download and merge updates

\= Branching

  • git branch β†’ list branches

  • git branch <name> β†’ create branch

  • git checkout <branch> / git switch <branch> β†’ change branch

  • git merge <branch> β†’ merge branch into current branch


Basic Developer Workflow (simple)

  1. Create project folder

  2. git init

  3. make changes

  4. git add .

  5. git commit -m "first commit"

  6. connect remote (GitHub)

  7. git push