Git and GitHub for Beginners: The Commands and Habits Every Fresher Needs
In college, you might share code over WhatsApp or keep folders called project-final-v3-REAL. In a job, every team uses Git. It's one of the first things interviewers and senior developers expect you to know, whether you're a MERN developer or a DevOps engineer.
Git vs GitHub
- Git is a tool on your computer that records every change to your code. You can go back to any earlier version, try ideas safely and merge work from other people.
- GitHub is a website that stores Git repositories online. Teams use it to review code, track issues and deploy. (GitLab and Bitbucket do similar jobs.)
Setting up
- Install Git from the official website (on Windows this includes Git Bash)
- Set your name and email:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
- Create a free GitHub account with a professional username (your name, not
coolboy_2005) - Set up authentication with GitHub (an SSH key, or sign in through Git Credential Manager)
The commands you'll use every day
| Command | What it does |
|---|---|
git init | Start tracking a folder with Git |
git clone <url> | Download a repository from GitHub |
git status | See what's changed |
git add <file> / git add . | Stage changes for the next commit |
git commit -m "message" | Save a snapshot with a message |
git log --oneline | See commit history |
git push | Upload your commits to GitHub |
git pull | Download and merge others' changes |
git branch | List or create branches |
git switch <branch> (or git checkout) | Move to another branch |
git switch -c <branch> | Create a branch and move to it |
git merge <branch> | Merge another branch into the current one |
git diff | See exactly what changed |
How teams actually work
- Pull the latest
mainbranch - Create a branch for your task:
git switch -c feature/login-form - Make changes, commit in small steps
- Push the branch to GitHub
- Open a pull request (PR) describing what you did
- A teammate reviews, you fix comments, the PR is merged
- Delete the branch and start the next task
Practise this flow on your own projects. Interviewers often ask how you'd handle a merge conflict or a code review.
Writing good commit messages
- Bad:
changes,fixed,final - Good:
Add login form validation,Fix cart total when coupon is removed
One logical change per commit. Present tense. Short first line.
Things that trip beginners up
- Committing secrets. Never commit passwords, API keys or
.envfiles. Add them to.gitignore. If you commit one by accident, change the key immediately; deleting the file isn't enough. - Committing
node_modules. Add it to.gitignore. - Merge conflicts. Git shows both versions in the file. Choose the right code, remove the markers, then commit.
- Working directly on main. Use branches, even on solo projects, to build the habit.
- Being afraid to experiment. That's what Git is for. Commit, then try.
Make your GitHub profile work for you
- A profile README with a one-line intro, skills and links
- Pinned repositories: your best 4–6 projects
- Each project with a README: what it does, screenshots, tech stack, how to run it, a live link
- Regular commits over months rather than everything on one day
Which projects to build: portfolio projects that get freshers hired.
Where to go next
Git is a foundation. Next steps depend on your path:
- Web development: build and deploy full-stack apps. See what is the MERN stack
- DevOps: Git triggers CI/CD pipelines. See the DevOps roadmap and Docker for beginners
Learn it with us
Both our live online courses for Shivamogga students use Git and GitHub from the first week, on real projects with code reviews: the MERN stack course and the DevOps course. See all courses.
Wbzard Labs
Want this done for your business?
We help founders in Bangalore and Shivamogga launch with a website, social media, SEO and ads that work together. Tell us about your business and get a free launch plan.

