💻 - Git Week 2 Day 3 – Ignoring, Viewing & Reverting Changes Today I learned how to manage what Git tracks, view what’s changed, and fix mistakes if something goes wrong. These commands are essential for keeping repositories clean and organised — especially when working in teams or deploying to production. ⸻ 🚫 Ignoring Files with .gitignore Not every file in a project needs to be tracked — things like logs, temporary files, and environment variables should be ignored. You can create a .gitignore file to tell Git which files to skip: Example: echo "*.log" > .gitignore This command creates a .gitignore file and ignores all files ending with .log. You can edit this file manually or create it directly on GitHub before pushing your repository. 🔍 Viewing Changes with git diff Before committing, you can see exactly what’s changed since your last save point: git diff This shows all modified lines that haven’t been staged yet — helpful for reviewing before committing. You can also compare two commits or branches, for example: git diff master This compares your current branch against the master branch. 🧹 Unstaging Files with git restore If you’ve added something by mistake with git add, you can unstage it before committing: git restore --staged file This removes the file from the staging area but keeps your changes safe in the working directory. ⸻ Learning how to ignore, review, and revert changes gave me a much clearer understanding of how Git tracks progress — and how to stay in control of my repository history. ⸻ Next Up: I’ll be diving into remote repositories — learning how to connect local work to GitHub using commands like git remote add, git push, and git pull. If you’re following my DevOps journey, stay tuned for how I connect my local projects to the cloud 🌐 #Git #DevOpsJourney #VersionControl #GitHub #CloudComputing #LearningInPublic
"Git Week 2: Ignoring, Viewing, Reverting Changes"
More Relevant Posts
-
What is Git? Git is a version control system — a tool that helps developers track changes in their code over time. Think of it like a “time machine” for code: You can save versions (called *commits*) of your project. You can see what changed, when, and who made the change. You can go back to an earlier version if something breaks. Multiple people can work on the same project without overwriting each other’s work. 💡 In short:Git manages versions of your project *locally* on your computer. --- ☁️ What is GitHub? GitHub is a cloud platform (a website) that uses Git under the hood. It lets you: * Store your Git repositories online. * Collaborate with others (e.g., through pull requests and issues). * Show off your projects publicly or keep them private. * Automate workflows (testing, deployment, etc.). 💡 In short:GitHub is where you *host and shareGit repositories online. --- ### 🧩 Example: Let’s say you’re building a website. 1. You create a Git repository on your computer to track your files (`git init`). 2. You make some changes, then save a snapshot (`git commit`). 3. You create a repository on GitHub. 4. You upload (push) your local code to GitHub (`git push`). 5. Your teammate clones it (`git clone`), makes changes, and sends them back (`git push`).- ### 🔁 Analogy: | Concept | Real-world Analogy | Git | A notebook where you record every change you make to a project | | GitHub | A shared online folder where everyone can see and contribute to that notebook | #Git #Github #Devops #learning
To view or add a comment, sign in
-
🔧 Advanced Git, GitHub, GitLab & GitLab CI Questions - Master Level Git Advanced Concepts: 1. Explain the difference between git rebase and git merge. When would you use interactive rebase? 2. What is git reflog and how can it help recover lost commits? 3. How do you handle merge conflicts in large codebases? Explain ours/theirs strategy. 4. What is the difference between git reset --soft, --mixed, and --hard? 5. Explain git cherry-pick and scenarios where you would use it. 6. How do you rewrite Git history safely? What are the risks? 7. What is git bisect and how do you use it to debug issues? 8. Explain git hooks and provide real-world use cases. 9. How do you handle large files in Git? What is Git LFS? 10. What is the difference between HEAD, working tree, and index? 11. Explain GitHub Actions workflow optimization techniques. 12. How do you implement matrix builds in GitHub Actions? 13. What are GitHub reusable workflows and composite actions? 14. How do you secure secrets in GitHub Actions? 15. Explain CODEOWNERS file and its use in pull request reviews. 16. Explain GitLab CI pipeline architecture and job dependencies. 17. How do you implement dynamic child pipelines in GitLab? 18. What are GitLab CI artifacts vs cache? When to use each? 19. Explain parallel and matrix jobs in GitLab CI. 20. How do you implement multi-project pipelines? 21. What are GitLab environments and deployment strategies? 22. How do you use GitLab CI variables and variable precedence? 23. Explain GitLab Auto DevOps and its components. 24. How do you implement security scanning in GitLab CI? 25. What is the difference between upstream and downstream pipelines? #Git #GitHub #GitLab #GitLabCI #DevOps #VersionControl #CICD #SoftwareEngineering #Automation #GitHubActions
To view or add a comment, sign in
-
DevOps Practical with #CloudDevOpsHub. Today, I practised hands-on with Git Bash and GitHub, learning how to push local code into a remote GitHub repository — an essential DevOps skill for version control and collaboration. Here’s the step-by-step process I followed 👇 echo "# day2ofdevops" >> README.md git init # Initialize a new Git repository git add * # Track all files git status # Check tracked/untracked files git config --global user.name "Ratnraj" git config --global user.email "ratnarajbsp@gmail.com" git add README.md # Add specific file git commit -m "first commit" # Commit changes git branch -M main # Rename branch to main git remote add origin https://lnkd.in/d2Fyed22 git push -u origin main # Push code to GitHub ✅ This exercise helped me understand: Git initialisation and configuration Adding and committing files Connecting local repos to GitHub Pushing code to the remote repository 💡 Every small step counts while mastering DevOps tools and version control. 🔗 Check out my repo here: https://lnkd.in/dVb-Sumr #DevOps #Git #GitHub #CloudDevOpsHub #LearningByDoing #VersionControl.
To view or add a comment, sign in
-
-
🚀 Understanding the Key Stages in Git If you're working with version control, knowing the flow of changes in Git is essential. Here’s a quick breakdown of the 4 main stages: 🔹 1. Working Directory This is where all your actual development happens. Files can be created, modified, or deleted — but Git hasn’t tracked them yet. 🔹 2. Staging Area (Index) When you run git add, your changes are moved to the staging area. Think of it as a “preview” of what you plan to commit. 🔹 3. Local Repository A git commit saves all your staged changes to the local Git repository — creating a permanent snapshot in your project history. 🔹 4. Remote Repository Finally, with git push, your commits move to a shared remote repo like GitHub or GitLab — making your work accessible to your team. 🧭 Simple Flow: Working Directory ➝ Staging Area ➝ Local Repo ➝ Remote Repo ✨ Bonus Tips: ✔ Stage only what’s needed for clean commit histories. ✔ Write meaningful commit messages — they save time in debugging. ✔ Pull before you push to avoid conflicts. ✔ Use branches to keep features isolated and safe. Mastering these stages helps ensure clean, organized, and collaborative development. 💡 Learning With @frontlinesedutech || AI Powered Multi Cloud DevOps Course #flm #frontlinesedutech #frontlinesmedia #MultiCloudDevOps #Git #GitCommands #VersionControl #DevTools #GitHub#OpenSource#LearnWithMahendar
To view or add a comment, sign in
-
How Git Works – Simple Explanation Git manages your code in three main areas: 1. Working Directory This is your project folder on your computer where you write and edit files. Examples in the image: .git/ → Git metadata __init__.py → Python file src/ → Source code folder Actions in this area: git add → Moves files from Working Directory → Stage git reset → Removes files from Stage → Working Directory 2. Stage (Staging Area / Index) A temporary holding area where you keep changes that you want to commit. Think of it like “packing items before shipping”. Action: git commit → Moves changes from Stage → Local Repository 3. Local Repository This is the Git database stored on your machine inside .git/. It stores all commits, versions, history. Commands that interact with it: git commit → Save changes to the local repo git checkout → Switch branches/restore files git merge → Combine two branches into one 4. Remote Repository This is the repo on GitHub, GitLab, or Bitbucket. It’s used for: Team collaboration Backup CI/CD pipelines Commands: git push → Upload commits from Local Repo → Remote Repo git pull → Fetch + merge changes from Remote Repo → Working Directory git fetch → Download changes but don’t merge automatically git clone → Copy a remote repo to your local machine Flow Summary When you modify files → Edit in Working Directory git add → Move to Stage git commit → Move to Local Repository git push → Move to Remote Repository When getting updates from the remote → git pull → brings code into your local machine (fetch + merge) Key Concepts (Simplified) Working Directory Your project files. Stage Area to queue changes before committing. Local Repository Git history stored locally. Remote Repository Hosted repo on GitHub/GitLab/Bitbucket. Platforms GitHub → Hosts repos, supports version control GitLab → CI/CD + repo management Bitbucket → Repo hosting + pipelines #Git #DevOps #VersionControl #GitCommands #SoftwareDevelopment #CodingTips #GitHub #GitLab #Bitbucket #LearnGit #TechLearning #ProgrammingBasics
To view or add a comment, sign in
-
-
💡 Git vs GitHub — The Most Common Confusion in DevOps Every new developer has faced this question at least once: 👉 “Is Git the same as GitHub?” Let’s clear it up 👇 📂 Git → A version control system that tracks your code changes locally. ☁️ GitHub → A cloud platform built on top of Git for sharing and collaboration. Think of it like a 4-step flow: [Working Directory] → [Staging Area] → [Local Repository] → [Remote (GitHub)] 🔧 Key Git Commands to Know Action Command Meaning Stage git add Move files to staging area Commit git commit -m "msg"Save your snapshot Push git push Upload commits to GitHub Pull git pull Download + merge updates ⚖️ Common Confusions git fetch ≠ git pull → Fetch just downloads, Pull downloads + merges. git merge keeps full history; git rebase creates a linear one. git reset --hard deletes changes; git revert safely undoes them. Mastering these small details makes version control smooth, safe, and powerful. 📘 I recently compiled all of this (with diagrams, examples, and GUI tools) into “Git & GitHub Complete Handbook – Illustrated Edition (2025)” for anyone learning Git the right way — from zero to advanced. Want the handbook or just want to discuss Git workflows? 💬 Comment “Git” below or DM me — let’s grow together 🚀 #Git #GitHub #DevOps #VersionControl #OpenSource #Learning #TechCommunity #YashKumarDubey #cloud #lerners #new #update
To view or add a comment, sign in
-
✅ Why Every Developer Should Master Git: More Than Just Version Control In modern software development, Git is no longer optional—it’s a fundamental skill. Whether you’re building enterprise applications, contributing to open-source, or managing cloud-native deployments, Git empowers teams to collaborate efficiently while maintaining complete control over code changes. At its core, Git is a distributed version control system that tracks changes, enables teamwork, and ensures code integrity. What makes Git the industry standard is not just versioning—it’s the freedom and safety it gives developers. ✅ Key Advantages of Using Git Branching & Merging: Developers can work on features independently without disrupting the main codebase. When ready, changes are merged with proper history. Collaboration Made Easy: GitHub, GitLab, and Bitbucket make teamwork seamless—pull requests, code reviews, and issue tracking become part of the workflow. Full History Tracking: Every change is recorded. You always know who changed what and why—making debugging and auditing simple. Distributed Architecture: Every developer has a full local copy of the repository, ensuring speed, reliability, and backup. ✅ Real-World Impact DevOps, CI/CD, and automation pipelines rely heavily on Git. Tools like Jenkins, Azure DevOps, and GitHub Actions pull code, trigger builds, run tests, and deploy applications automatically. Without Git, modern automation simply wouldn’t work. ✅ If You’re New to Git Start with the basics: init, add, commit, push, and pull. Then explore branching strategies like GitFlow, feature branching, and trunk-based development. The more you use Git, the more powerful it becomes. 🔁 Whether you're a beginner or a senior engineer, improving Git skills enhances productivity and teamwork—and keeps you aligned with industry best practices. #Git #DevOps #GitHub #SoftwareDevelopment #Coding #VersionControl #Programming #Cloud #Automation #Linux #Developers #CI #CD #AzureDevOps #GitLab
To view or add a comment, sign in
-
✅ Why Every Developer Should Master Git: More Than Just Version Control In modern software development, Git is no longer optional—it’s a fundamental skill. Whether you’re building enterprise applications, contributing to open-source, or managing cloud-native deployments, Git empowers teams to collaborate efficiently while maintaining complete control over code changes. At its core, Git is a distributed version control system that tracks changes, enables teamwork, and ensures code integrity. What makes Git the industry standard is not just versioning—it’s the freedom and safety it gives developers. ✅ Key Advantages of Using Git Branching & Merging: Developers can work on features independently without disrupting the main codebase. When ready, changes are merged with proper history. Collaboration Made Easy: GitHub, GitLab, and Bitbucket make teamwork seamless—pull requests, code reviews, and issue tracking become part of the workflow. Full History Tracking: Every change is recorded. You always know who changed what and why—making debugging and auditing simple. Distributed Architecture: Every developer has a full local copy of the repository, ensuring speed, reliability, and backup. ✅ Real-World Impact DevOps, CI/CD, and automation pipelines rely heavily on Git. Tools like Jenkins, Azure DevOps, and GitHub Actions pull code, trigger builds, run tests, and deploy applications automatically. Without Git, modern automation simply wouldn’t work. ✅ If You’re New to Git Start with the basics: init, add, commit, push, and pull. Then explore branching strategies like GitFlow, feature branching, and trunk-based development. The more you use Git, the more powerful it becomes. 🔁 Whether you're a beginner or a senior engineer, improving Git skills enhances productivity and teamwork—and keeps you aligned with industry best practices. #Git #DevOps #GitHub #SoftwareDevelopment #Coding #VersionControl #Programming #Cloud #Automation #Linux #Developers #CI #CD #AzureDevOps #GitLab
To view or add a comment, sign in
-
✅ Why Every Developer Should Master Git: More Than Just Version Control In modern software development, Git is no longer optional—it’s a fundamental skill. Whether you’re building enterprise applications, contributing to open-source, or managing cloud-native deployments, Git empowers teams to collaborate efficiently while maintaining complete control over code changes. At its core, Git is a distributed version control system that tracks changes, enables teamwork, and ensures code integrity. What makes Git the industry standard is not just versioning—it’s the freedom and safety it gives developers. ✅ Key Advantages of Using Git Branching & Merging: Developers can work on features independently without disrupting the main codebase. When ready, changes are merged with proper history. Collaboration Made Easy: GitHub, GitLab, and Bitbucket make teamwork seamless—pull requests, code reviews, and issue tracking become part of the workflow. Full History Tracking: Every change is recorded. You always know who changed what and why—making debugging and auditing simple. Distributed Architecture: Every developer has a full local copy of the repository, ensuring speed, reliability, and backup. ✅ Real-World Impact DevOps, CI/CD, and automation pipelines rely heavily on Git. Tools like Jenkins, Azure DevOps, and GitHub Actions pull code, trigger builds, run tests, and deploy applications automatically. Without Git, modern automation simply wouldn’t work. ✅ If You’re New to Git Start with the basics: init, add, commit, push, and pull. Then explore branching strategies like GitFlow, feature branching, and trunk-based development. The more you use Git, the more powerful it becomes. 🔁 Whether you're a beginner or a senior engineer, improving Git skills enhances productivity and teamwork—and keeps you aligned with industry best practices. #Git #DevOps #GitHub #SoftwareDevelopment #Coding #VersionControl #Programming #Cloud #Automation #Linux #Developers #CI #CD #AzureDevOps #GitLab
To view or add a comment, sign in
Explore related topics
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