#What is Git?
Git is a free, open-source version control system that tracks changes in your code (or any files) over time. It lets developers work on projects of any size, revert to previous versions if needed, experiment safely with branches, and collaborate with others without overwriting each other's work.
What is Git Bash?
Bash is the default command-line shell on Linux and macOS
Git Bash is a lightweight application for Windows that brings a Bash-like Unix-style terminal environment, including Git commands. It allows Windows users to run Git and many Unix commands seamlessly in a familiar shell.
Git Bash is installed locally on your computer.
What is GitHub?
GitHub is a cloud-based hosting platform built on top of Git. It lets you store your Git repositories online, share code with others, collaborate in teams, review changes via pull requests, and discover open-source projects.
Installing Git Bash (Windows)
- Go to the official Git website: https://git-scm.com/downloads
- Download the Windows installer (it includes Git Bash).
-
Run the downloaded
.exefile and follow the setup wizard.- Accept defaults for most options (they work well for beginners). -Choose your preferred text editor (e.g., Notepad++ or VS Code if installed). -Keep line ending conversion enabled for cross-platform compatibility.
Complete the installation.
Verify installation
Open Git Bash (search for "Git Bash" in the Start menu) and run:bash
git --version
You should see something like git version 2.XX.X.windows.X.
Initial Git Configuration
Set your name and email (these appear in your commits):bash
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"
Use the same email you have on your GitHub account.
Linking Git Bash to Your GitHub Account (Using SSH)
SSH keys provide secure, password-less authentication for pushing/pulling code.
1.Generate a new SSH key (in Git Bash)
ssh-keygen -t ed25519 -C"your.email@example.com"`
-Press Enter to accept the default file location (~/.ssh/id_ed25519).
-Optionally set a passphrase (recommended for extra security).
2.Start the SSH agent and add your key:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
3.Copy your public key to the clipboard:
cat ~/.ssh/id_ed25519.pub
(Select and copy the output starting with ssh-ed25519 ...)
4.Add the key to GitHub:
- Log in to GitHub → Click your profile picture → Settings → SSH and GPG keys → New SSH key.
- Give it a title (e.g., "My Windows PC").
- Paste the key and click Add SSH key
Test the connection:
ssh -T git@github.com
You should see: Hi username! You've successfully authenticated...
Pulling and Pushing Code
git pull
Fetches changes from the remote repository (e.g., GitHub) and merges them into your local branch.
git pull origin main
(git pull = git fetch + git merge)
Always pull before starting work to avoid conflicts.
git push
Uploads your local commits to the remote repository.
git push origin main
-
origin= default name for your GitHub remote. -
main= default branch name (some older repos usemaster).
If it's your first push to a new repo, you may need to set upstream:
git push -u origin main
Tracking Changes – The Core Workflow
Use these three commands in almost every session:
1.git status
Shows what's changed, staged, or untracked.
git status
2.git add
Stages changes (prepares them for commit).
- Stage one file:
git add filename.txt - Stage all changes:
git add. orgit add -A
3.git commit
Saves staged changes permanently with a message.
git commit -m "Add new feature: user login page"
Good commit messages are short, descriptive, and in present tense (e.g., "Fix bug in login form").
Typical workflow:
git status # Check what's changed
#Edit files...
git add . # Stage everything
git commit -m "Your message here"
git pull origin main # Get latest changes first!
git push origin main # Send to GitHub
What is Version Control and Why It Matters
Version control records every change to files over time so you can recall specific versions later.
Key benefits:
- Full history of who changed what and why.
- Branching & merging: Work on features/bug fixes in isolation, then combine safely.
- Easy rollback if something breaks.
- Collaboration: Multiple people work on the same project without chaos.
- Backup: Your code lives safely on GitHub.
Master these basics, and you'll be ready to create repositories, clone projects, create branches, and contribute to open source!
Happy coding!
Feel free to practice by creating a simple repo on GitHub and pushing a "Hello World" file.



Top comments (0)