Techn0tz

Empowering self-learners through clean, beginner-friendly tutorials on Git, Jekyll, and more.

This project is maintained by manjushaps

Feedback Form
Previous: Version Control: The Backbone of Modern Development | Next: Git Series: Part 2 - Remote repository - GitHub | Up: Home

๐Ÿš€ From VCS to Git

In the last post, we explored Version Control System and their types โ€” CVCS and DVCS. Now, letโ€™s zoom into the most popular DVCS tool in the world: Git โ€” and see how it powers modern development.


๐Ÿ“œ What is Git?

Git is open source Distributed Version Control Sytem which allows developers

  • Track changes in code over time
  • Collaborate seamlessly with teammates
  • Create branches for experimental study
  • Roll back to previous versions when things goes wrong

โŒ›Think of Git as your projects time machine - but smarter, faster and made for team work


๐ŸŽฏ Core Components Git and LVC worflow

The Git workflow is a step-by-step process that defines how changes in a project move from your local machine to a shared, remote repository like GitHub. Mastering this flow helps you collaborate smoothly and manage versions efficiently.

This post explains about Git basics and how the files are committed locally

The core components of LVC worflow are: Working Directory, Staging Area, Local Repository. Understanding how files move through these stages are essential.

LVC Workflow

The diagram above outlines the LVC process. Now, letโ€™s explore each stage and see how your local project files eventually become committed, shared history.

๐Ÿ“‚ Working Directory

This is the local folder on your computer where you edit and work on your project files

  • git init command - Intializes a Git repository
    • The Git starts tracking the specified folder as a Git project- in other words, your plain folder(working directory) is converted into .Git project
    • Creates a hidden .git. folder in the working directory
    • This .git/ folder contains everything that Git needs to track your project (eg. commit, branch, logs etc)
    • Your working directory stays the same, but now Git is watching for changes

๐Ÿ—ƒ๏ธ Staging Area

The staging area (index) is like a holding zone- where Git gathers all the changes that you want to commit

  • git add command - moves the changes from working directory to the staging area
    • git add filename - Adds a specific file to the staging area
    • git add . - Adds all the modified files in the folder

๐Ÿ“ Local Repository

The local repository is the .git directory- which is the Gitโ€™s repository storage

  • git commit command - the changes from the staging area are permanently stored in the repository
    • The repository is located inside the hidden .git/ folder- the one created by git init
    • The .git directory contains all the commits, project history, branches, logs etc

๐Ÿ’กExample Snapshot: From init to commit in LVC

The snapshot below provides a practical example of how to create a new directory, initialize a Git repository, and set up local version control. It will walk you through the essential steps, including adding files to the staging area, committing changes, and managing version history on your local machine. By following along, youโ€™ll gain hands-on experience in using Git for efficient source code management.

LVC_example


๐Ÿง  TechNuggetz - Did you Know?

โŒ› Git was built by Linus Torvalds - Founder of Linus in just 2 weeks in 2005 - Iconic!

โ˜‘๏ธ Git knows everything locally, it dosenโ€™t need internet to track changes - from version history, staging and committing - everithing happens in your local machine.

โŒ Made a mistake? git checkout -- filename - restores a file to its last committed state

๐Ÿ—‚๏ธ Track only what matters! Use a .gitignore file to prevent sensitive data (like passwords, logs, or config files) from slipping into your commits. A cleaner repo is a safer repo!

๐Ÿช„ Autosave magic! Use git stash to save your work-in-progress without a commit. Come back later with git stash pop and pick up right where you left off!

Continue.. ๐Ÿ‘‰ To push your Git project to Remote repository like GitHub Part-2:Remote-repository

Happy Learning!

Previous: Version Control: The Backbone of Modern Development | Next: Git Series: Part 2 - Remote repository - GitHub | Up: Home
Enjoyed this post? Rate it!