🚀 Git & GitHub Simplified: How VS Code and Git Bash Work Together – What I Learned at Devsync.in


Introduction
Version control is a crucial skill for any developer, and during my learning journey at Devsync.in, I had the opportunity to explore it in depth. In this blog, I’ll walk you through the fundamentals of Git and GitHub, and how to use them effectively alongside Git Bash and Visual Studio Code (VS Code). These tools are essential for tracking code changes, collaborating with teams, and keeping your codebase organized and secure.
🧠 What Are Git and GitHub?
🔧 What Is Git?
Git is a distributed version control system that helps you manage your project’s codebase. Think of Git as your project’s timeline tracker. Every time you make a change, you take a snapshot (commit) that you can revert to or share with others.
Key Features:
Local tracking of file changes
Support for branching & merging
Complete history of code evolution
Offline operation
Example Use Cases:
Saving progress of your code (git commit)
Experimenting with features using branches
Undoing mistakes with git revert or git reset
🌍 What Is GitHub?
GitHub is a cloud platform built on top of Git that makes collaboration easier. It hosts your repositories online and provides:
Pull Requests for reviewing changes
Issues for tracking bugs and features
GitHub Actions for CI/CD automation
Wikis and documentation support
It turns Git into a teamwork powerhouse. At Devsync.in, we used GitHub daily to push code, raise pull requests, and review contributions.
💻 What Is Git Bash?
Git Bash is a command-line terminal for Windows that supports Git commands and Unix-style commands like ls, touch, cat, etc.
Why is it better than CMD or PowerShell for Git?
Familiar shell experience for Linux/Mac users
Better support for chaining commands
Easier scripting and automation
Common Git Bash Commands:
I used Git Bash at Devsync.in daily to interact with Git more efficiently than through a GUI.
🧩 How VS Code & Git Bash Work Together
🎯 Why Use VS Code?
Visual Studio Code (VS Code) is a popular, free code editor created by Microsoft. It has built-in support for Git, so you can:
View file changes
Stage, commit, and push changes
See Git history
Resolve merge conflicts visually
🔗 How to Set Git Bash as VS Code’s Terminal
At Devsync.in, we learned how to set Git Bash as the default terminal inside VS Code — combining the power of a terminal with the comfort of a modern code editor.By default, VS Code uses PowerShell or CMD as its terminal on Windows. But you can switch it to Git Bash:
Steps:
Open VS Code.
Press Ctrl + Shift + P to open the command palette.
Type: Preferences: Open Settings (JSON)
Add this line in the JSON settings:
Now every time you open the terminal in VS Code, it will use Git Bash instead of PowerShell.
🔁 Git Workflow Explained (Visual Guide)
The image below shows the standard Git workflow — how your code travels from your local machine to a remote repository like GitHub.
📂 Working Directory
This is where you make your code changes. It's your local project folder.
🧊 Staging Area (Index)
When you run git add, your files move from the working directory to the staging area. This prepares them for the next commit.
🗃️ Local Repository
When you commit using git commit, changes move from the staging area into your local Git repository — now they're officially part of your project history.
☁️ Remote Repository
Using git push, you send your local commits to a remote repository (like GitHub).
When collaborating with others, you use git pull to fetch and merge changes from the remote repo.
🔄 Additional Commands:
git checkout: Switch branches or revert files to a previous state.
git merge: Combine changes from one branch into another, e.g., feature → main.
🛠️ Common Git Issues I Faced (and Fixed)
❌ Merge Conflicts
When two people change the same file, Git doesn’t know which to keep. I learned how to manually resolve conflicts using the merge editor in VS Code.
❌ Detached HEAD State
I once checked out a commit instead of a branch and couldn’t commit. Lesson: always create a new branch after checking out a commit!
❌ Accidentally Pushed Wrong File
With git reset HEAD~1 and a new commit, I was able to clean it up
These issues were part of the learning curve — and solving them helped me grow at Devsync.in.
🚀 Ready to Master Real-World Development Tools?
Take your Git, GitHub, and full-stack skills to the next level with live projects, hands-on Git workflows, and developer-focused mentorship at Devsync.in
Canonical URL: https://hashnode.com/Devsync
Subscribe to my newsletter
Read articles from Riya Harankhede directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
