Why I built Git from scratch (and why its storage model is genius) I’ve used Git many times, but for a long time it felt like a "black box" of magic. To truly understand it, I built 𝗠𝘆𝗚𝗶𝘁 - a simplified but fully functional implementation of Git's core internals and functionality from the ground up in Java. 💡The "Aha!" Moment: Content-Addressable Storage The most fascinating part was implementing Git’s filesystem. Git doesn't think in terms of “files” rather it thinks in terms of immutable objects. Seeing how Blobs, Trees, Commits and Tags are hashed with SHA-1 and compressed with Zlib made me realize how elegant Git’s de duplication really is. If two files have the same content, they share the same SHA, a simple concept that is incredibly powerful in practice. 💻Technical Deep-Dives 🔷Binary Staging Area: I implemented the Git Index v2 format from scratch, handling raw bytes and file metadata (timestamps, permissions, inodes) for efficient change detection. 🔷Flexible Object Resolution: Developed a system to resolve everything from full/short SHAs to branches, tags, and special refs like HEAD. 🔷 Advanced Logic: Programmed custom .gitignore pattern matching (wildcards/negations) and a stack-based DFS algorithm for traversing complex commit histories. This is where the DSA grind shines! 🔷 Core Java Workout: This was a massive exercise in low-level Java, specifically deep-diving into NIO, ByteBuffers and binary serialization instead of relying on high-level abstractions. 📗What I Learnt Building this taught me more about systems design and data integrity than any tutorial could. It’s one thing to understand a RAG pipeline; it’s another to manage a binary filesystem where a single misplaced byte can corrupt an entire repository history. This project wasn't about building a production-grade clone (for that, JGit exists!), but about building for depth. It’s about sharpening my Java skills and understanding the internal mechanics of the tools I use every day. 🔗Check out the repo here: https://lnkd.in/ggwNXNQZ 📝References: Git Internals - Plumbing and Porcelain, Git from the Bottom Up #Java #Git #SystemDesign #BuildFromScratch
Building Git from Scratch in Java: A Systems Design Exercise
More Relevant Posts
-
GitHub Actions Simplified: Breaking Down a CI/CD Pipeline 🚀 Ever felt like YAML files were written in a secret language? If you're looking to automate your workflow, GitHub Actions is the powerhouse you need to master. This visual guide breaks down a standard Java/Maven CI/CD pipeline into bite-sized pieces. Here is the core logic of what’s happening: 1. The Trigger (on:) Everything starts with an event. In this example, the pipeline wakes up whenever someone pushes code or opens a pull request to the main branch. No manual intervention required! 2. The Build & Test Job Before code goes live, it needs to be validated. • Environment: It runs on ubuntu-latest. • Steps: It checks out your code, sets up the Java environment (JDK 11), builds the app with Maven, and runs automated tests. If a test fails here, the process stops—saving you from breaking production. 3. The Deployment Job (needs: build) This is the "CD" part of CI/CD. Notice the needs: build tag? This creates a dependency, ensuring deployment only happens if the build and tests were successful. • It packages the app into a Docker image. • It uses docker-compose to refresh the running services. 4. Notifications Once the heavy lifting is done, the pipeline sends an automated email to the team. Success is confirmed, and everyone stays in the loop without checking logs. The Bottom Line: Automation isn't just about saving time; it’s about creating a repeatable, reliable process that catches bugs early and deploys with confidence. What’s your favorite GitHub Action trick or marketplace plugin? Let’s chat in the comments! 👇 #GitHubActions #CICD #DevOps #SoftwareEngineering #Automation #CodingTips #TechCommunity
To view or add a comment, sign in
-
-
🚫 What is .gitignore & Why You Should Use It When working with Git, not every file belongs in your repository. That’s where .gitignore comes in — it tells Git which files and folders to ignore. 🔹 Why use .gitignore? Avoid uploading sensitive data (API keys, passwords) Keep your repo clean (no unnecessary files) Ignore system files & dependencies 🔹 How to create a .gitignore file In your project root, create a file named: .gitignore 🔹 Common Examples # Ignore node modules node_modules/ # Ignore environment files .env # Ignore Python cache files __pycache__/ *.pyc # Ignore logs *.log # Ignore OS files .DS_Store Thumbs.db 🔹 How it works Git will automatically ignore the files listed in .gitignore when you run: git add . 💡 Pro Tip: If a file is already tracked by Git, adding it to .gitignore won’t remove it. You’ll need to untrack it first: git rm --cached filename Using .gitignore properly makes your projects cleaner, safer, and more professional 💯 #Git #GitHub #Programming #Python #WebDevelopment #Developers #CodingTips # .gitignore - tells Git what NOT to track .venv/ .env __pycache__/ *.pyc .DS_Store
To view or add a comment, sign in
-
⚡ Maven vs Gradle — Which one should you learn? If you're starting with Java build tools, this confusion is REAL. So I broke it down in a simple infographic 👇 #What are Build Tools? ==> Build tools like Apache Maven and Gradle help you: -> Compile code -> Manage dependencies (libraries) -> Run tests -> Package your app (JAR/WAR) -> Automate everything 👉 Instead of doing things manually, they do it in one command #What is Maven? ==> Think of Maven as: “Strict teacher who gives you a fixed structure” Key Points: -> Uses XML (pom.xml) -> Follows convention over configuration -> Easy to learn -> Widely used in Spring Boot Example: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> 👉 Just add this → Maven downloads everything automatically #What is Gradle? (Modern approach) ==> Think of Gradle as: “Flexible tool where you can do things your way” Key Points: -> Uses Groovy / Kotlin DSL -> Faster builds ⚡ -> Highly customizable -> Used in modern projects (Android, microservices) Example: implementation 'org.springframework.boot:spring-boot-starter-web' 👉 Cleaner + shorter than Maven #When should YOU use what? 👉 Start with Maven if: -> You’re a beginner -> You want structure -> You’re learning Spring Boot 👉 Use Gradle if: -> You want speed -> You’re working on big projects -> You need customization #Real-world tip (important) ==> Most beginners overthink this. 👉 Truth: -> Both are used in industry -> Switching later is EASY -> Focus more on DSA + projects #Key Takeaways: • Maven = Simple, structured, beginner-friendly • Gradle = Faster, flexible, industry-preferred #My suggestion: Start with Maven → Move to Gradle later Which one do you use? 🤔 #Java #Maven #Gradle #BuildTools #Programming #Backend #SpringBoot #Coding #Tech
To view or add a comment, sign in
-
-
🚀 Today UNDERSTOOD How Maven Works in Spring Projects 🔥 Today I moved beyond just using Maven… I actually understood what’s happening behind the scenes. 🧠 The Confusion I Had I used to think: 👉 Maven = just for adding dependencies 👉 pom.xml = copy-paste config file But I never questioned: Where do dependencies actually come from? What happens when we run a build command? How does everything connect automatically? 🧩 What Maven Actually Does Maven is not just a dependency manager — it’s a build automation tool that controls the entire project lifecycle. It handles: ✔ Dependency management ✔ Build process ✔ Project structure ✔ Lifecycle execution 📦 The Heart: pom.xml This file is the brain of your project. It defines: Dependencies (Spring Boot, MySQL, etc.) Plugins Build configurations Project metadata 👉 Maven reads this file and decides everything based on it. 🔄 How Maven Works Internally 1️⃣ You define dependencies in pom.xml 2️⃣ Maven checks Local Repository (.m2 folder) 3️⃣ If not found → downloads from Maven Central (Remote Repo) 4️⃣ Stores locally for future use 👉 That’s why dependencies don’t download again and again. ⚙️ Build Lifecycle (Real Power 🔥) When you run: mvn install Maven runs phases in sequence: ➡ Compile → Test → Package → Install → Deploy Compile → Java → Bytecode Test → Runs unit tests Package → Creates JAR/WAR Install → Stores in local repo Deploy → Pushes to remote repo 👉 You trigger one command, Maven handles everything. 🏗 What Changed for Me Earlier: ❌ “Project chal raha hai bas 😅” Now: ✅ Maven = automation engine behind Spring projects ✅ It converts code → runnable application → deployable artifact ⚡ Real Example mvn spring-boot:run Behind the scenes: Dependencies resolved Code compiled Server started 👉 No manual steps. Fully automated. 📌 Key Takeaways ✔ pom.xml controls everything ✔ .m2 stores dependencies locally ✔ Maven Central is the global source ✔ Lifecycle = automation backbone ✔ One command = complete build flow 🙏 Final Thought If you're learning Spring Boot and skipping Maven concepts, you're missing the foundation. Understanding Maven turns you from: ❌ Tool user ➡️ ✅ System thinker 💬 Curious — what was the moment you truly understood Maven? #Java #SpringBoot #Maven #BackendDevelopment #FullStackDeveloper #LearningInPublic #SoftwareEngineering #Developers #Tech
To view or add a comment, sign in
-
-
🚀 Jenkins : Java & Jenkins Pipeline Fundamentals Here’s a structured summary of what I worked on recently as part of my DevOps journey: 🔹 Java Fundamentals Refresher Understood the compilation lifecycle: .java → compiled using javac → .class (bytecode) Learned how JVM ensures platform independence (Write Once, Run Anywhere) Practiced execution using java ClassName Reinforced importance of file naming conventions and environment setup 🔹 Jenkins Setup & Configuration Installed Jenkins on Ubuntu 24.04 LTS Configured Java (JDK 21) and required dependencies Completed initial setup: Admin user creation Plugin installation Access via port 8080 🔹 Exploring Jenkins Plugins Key plugins explored for real-world CI/CD: Git Integration Maven Build Tool Docker SonarQube Email Extension Pipeline Plugin Blue Ocean UI 🔹 Pipeline Fundamentals Transitioned from Freestyle Jobs → Pipeline Jobs Learned two major pipeline approaches: Scripted Pipeline (flexible, Groovy-based) Declarative Pipeline (structured & recommended) 📌 Basic structure: pipeline { agent any stages { stage('Build') { steps { // commands } } } } 🔹 Pipeline Implementation (Hands-on) Created my first pipeline: my-first-pipeline Stages implemented: Git Clone Compile (Java) Run Application Integrated: Maven build (mvn clean package) Email notifications CI trigger using Poll SCM 🔹 CI/CD in Action Connected Git repository with Jenkins Automated build + execution pipeline Learned deployment using: java -jar Background execution with nohup 🔹 Troubleshooting & Learnings Resolved Java version conflicts (JAVA_HOME & PATH) Fixed Maven issues (command not found) Understood importance of: Background processes (&, nohup) Workspace management Monitoring logs via Jenkins console output 🔹 Key Takeaways ✔ Pipelines are scalable, maintainable, and version-controlled ✔ Declarative pipelines simplify complex workflows ✔ CI/CD automation reduces manual errors and speeds up delivery ✔ Debugging is a critical DevOps skill, not optional 💡 This session strengthened my understanding of how Java applications integrate into CI/CD pipelines using Jenkins. Looking forward to diving deeper into Docker, Kubernetes, and advanced pipeline automation next! #DevOps #Jenkins #Java #CICD #Automation #LearningJourney #Cloud #Maven #Git #SoftwareEngineering
To view or add a comment, sign in
-
-
As a Java Full Stack Developer, CI/CD isn't just a DevOps concern, it's part of how you ship Spring Boot APIs and React/Angular frontends without holding your breath every Friday afternoon. Here's how I think about the pipeline in a Java stack: 1 Push triggers the pipeline A git push kicks off GitHub Actions or Jenkins — no one manually runs a build. 2 Maven / Gradle builds and tests JUnit tests, integration tests, and SonarQube static analysis run automatically. Bugs get caught here — not in prod. 3 Docker image is built and versioned Your Spring Boot JAR gets packaged into a Docker image, tagged with a commit SHA, and pushed to a registry. 4 Deploy to staging, then prod The image is promoted through environments — dev → staging → prod — via Kubernetes or ECS, with a single approval gate before production. The real win isn't deploy speed. It's that every change is small, tested, and reversible. Rolling back a bad Spring Boot release is a one-liner when your image is versioned and your pipeline is clean. In the Java world this usually means: GitHub Actions or Jenkins for orchestration, Maven or Gradle for builds, JUnit + Mockito for testing, SonarQube for code quality, Docker + Kubernetes or ECS for deployment. The tools var, the discipline doesn't. If you're still SSHing into servers and running java -jar by hand, CI/CD is the highest-leverage change you can make to your workflow. #Java #SpringBoot #CICD #DevOps #FullStackDevelopment #SoftwareEngineering #Jenkins #GitHub Actions #Docker #Kubernetes
To view or add a comment, sign in
-
-
Still confused between git add, git commit, and git push? Here’s a beginner-friendly cheat sheet of the most commonly used Git commands 👇 🔹 git init Initialize a new Git repository. 🔹 git clone <repo-url> Copy an existing repository to your local machine. 🔹 git status Check which files are changed, staged, or not tracked. 🔹 git add <file> Add a file to the staging area. Use git add . to add all changed files. 🔹 git commit -m "message" Save your changes with a meaningful message. 🔹 git push Upload your local commits to the remote repository. 🔹 git pull Fetch the latest changes from the remote repository. 🔹 git branch View all branches. 🔹 git checkout <branch-name> Switch to another branch. 🔹 git checkout -b <branch-name> Create and switch to a new branch. 🔹 git merge <branch-name> Merge another branch into your current branch. 🔹 git log View commit history. 🔹 git diff See the difference between your current code and previous version. 🔹 git rm <file> Delete a file from the repository. 🔹 git reset --hard Undo all local changes (use carefully ⚠️) 💡 Most common Git workflow: git status git add . git commit -m "your message" git push Mastering Git is one of the most important skills for every developer, tester, and automation engineer. Which Git command do you use the most? 👇 #Git #GitHub #Programming #Developer #SoftwareTesting #AutomationTesting #Python #Java #Coding #Tech #SoftwareEngineer #LearnToCode
To view or add a comment, sign in
-
-
CI Pipeline: Done. I just finalized the Continuous Integration (CI) pipeline for my backend Task Management project using GitHub Actions. Instead of just "making it work," I focused on three core engineering principles: Three principles I followed while building this: No drift between local and CI: Every command that runs in CI also runs locally through Taskfile.yml. A developer running task ci:test locally gets the exact same behaviour as the CI test job. There are no CI-only scripts. Fail fast, fail clearly: Type checking and linting run in parallel before tests. If your types are wrong or your code has lint errors, you know within seconds, before a database spins up or a Docker image builds. Docker push is a privilege, not a default: The image is only built and pushed to Docker Hub when a commit lands on main via a direct push (i.e., a merged pull request). Feature branches and pull requests run all quality checks but never touch Docker Hub. Tech stack: Node.js, TypeScript, Fastify, PostgreSQL, Docker, GitHub Actions, Vitest, ESLint. Learnt alot while building this, the link for the project is in comments below 👇 👇 check it out. Next step: Setting up CD (automatic deployment). #backend #nodejs #docker #githubactions #cicd #typescript
To view or add a comment, sign in
-
Writing Java is easy… building it properly is the real challenge👀 Day 21 of my DevOps Journey 🚀 Today I started learning Maven — a powerful build tool used for Java projects. In real-world projects, building and managing that code is important. What I learned today: • Maven is used to build and manage Java projects • It handles dependencies automatically • It helps compile, package, and prepare applications At the core of Maven is: 👉 pom.xml This file defines: • Project structure • Dependencies • Build configuration Common Maven commands: • mvn clean → removes previous builds • mvn compile → compiles source code • mvn package → creates .jar / .war file Day 21 realization 💡 Writing code is just one part. Building it efficiently is what makes it production-ready Next step — integrating Maven builds into Jenkins 🔥 Have you used Maven or any other build tools? 👇 #DevOps #Maven #Java #Jenkins #CICD #100DaysOfDevOps #Day21
To view or add a comment, sign in
-
Another step forward in my Spring Framework learning journey. Today, I worked on one of the most important concepts in backend development: Dependency Injection using @Autowired and Annotation-Based Configuration. Instead of manually creating objects with the new keyword, Spring automatically manages objects (beans) and injects dependencies wherever required. This makes code cleaner, more maintainable, and easier to scale. What I Implemented Today: • @Component for automatic bean creation • @Autowired for dependency injection • @ComponentScan for package scanning • Java-based configuration using configuration classes • Layered structure with Repository, Service, and Test packages • Object management using Spring IoC Container Project Flow: • Repository layer created as a bean • Service layer automatically received Repository dependency • Application context loaded configuration • Final object fetched from container and executed successfully Key Learning: When objects are managed by Spring instead of manual creation, code becomes loosely coupled and follows professional development practices. Why This Matters: In real-world backend applications, managing dependencies manually becomes messy as projects grow. Spring solves this problem with IoC and Dependency Injection. This hands-on implementation helped me understand not only how annotations work, but why Spring is widely used in enterprise applications. Special thanks to Prasoon Bidua Sir for the guidance and clear explanation of concepts. #Java #Spring #SpringFramework #Autowired #DependencyInjection #IoC #BackendDevelopment #Programming #SoftwareDevelopment #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development