DEV Community

Preeti yadav
Preeti yadav

Posted on

🧠 GitHub Basics Every Developer Should Know (But Many Don’t)

Whether you’re a beginner or already pushing code daily, chances are you’ve used GitHub. But beyond the usual git add . and git push, there are some simple yet powerful practices that many developers miss—ones that can level up your collaboration, project management, and confidence as a coder.

Let’s walk through the essential GitHub skills that every developer should know, with friendly explanations and practical tips. šŸ’”

šŸ·ļø 1. Write Meaningful Commit Messages

Bad: fixed stuff
Better: Fix: correct margin issue in header component

Use a verb prefix (Add:, Fix:, Update:) to summarize your change.

Keep the message short, but descriptive.

Format:

git commit -m "Fix: handle null values in user profile API"
Enter fullscreen mode Exit fullscreen mode

šŸ”§ Pro tip: Use git commit -m "type: short message" for clarity in team projects.


🌿 2. Create and Use Branches Properly

Avoid pushing everything to main (or master)!

git checkout -b feature/login-page

Enter fullscreen mode Exit fullscreen mode

Why?

  • Keeps your main branch clean
  • Lets you experiment without fear
  • Makes collaboration smoother (everyone works on their own branch)

Merge it later via pull request (PR), after code review.


šŸ“¦ 3. Squash Your Commits Before Merging

You’ve probably seen PRs with 20 commits like:

  • fix typo
  • try again
  • finally working

Instead, squash them into one clean commit:

git rebase -i HEAD~4
Enter fullscreen mode Exit fullscreen mode

Then choose squash for the messy ones and rewrite your final commit message.

🧼 Result: a tidy Git history.

šŸ›” 4. Use .gitignore to Avoid Committing Unwanted Files

You don’t want to accidentally upload:

  • node_modules/
  • .env
  • dist/

Use a .gitignore file:

  • node_modules/
  • .env
  • *.log

Use gitignore.io to generate templates for your tech stack.


šŸ”€ 5. Understand Pull Requests (PRs)

PRs are not just about merging code—they're conversations. šŸ‘‡

  • Add clear titles and descriptions
  • Tag teammates for review
  • Leave comments and ask questions

Also, don’t be afraid to suggest improvements on someone else’s PR.


🧩 6. Forking vs Cloning

Clone: You’re working on your own repo locally.

Fork: You copy someone else’s repo to your GitHub account so you can propose changes (especially for open source).

git clone https://github.com/user/repo.git
Enter fullscreen mode Exit fullscreen mode

ā³ 7. Revert a Commit (When You Break Something šŸ˜…)

Oops! You pushed something buggy. Instead of panicking:

git revert <commit-hash>
Enter fullscreen mode Exit fullscreen mode

This creates a new commit that undoes the previous one—safe and clean.


āœ… 8. Enable GitHub Issues & Projects (Lightweight Task Management)

If you're building a project solo or with a team, track bugs, features, and todos right inside GitHub with:

  • Issues
  • GitHub Projects

They integrate beautifully with pull requests and commits.

šŸŽ‰ Final Thoughts

You don’t need to memorize every Git command. But knowing how to write good commits, use branches, clean up your history, and collaborate with PRs will make you a more effective and professional developer.

It’s not just about writing code—it’s about writing traceable, understandable, and collaborative code.

āœļø What GitHub trick blew your mind when you first learned it? Drop it in the comments!

šŸ” Want a part 2 with advanced Git tips like stash, cherry-pick, or GitHub Actions? Let me know!

Top comments (4)

Collapse
 
sawyerwolfe profile image
Sawyer Wolfe

A quick tip: You can use git status often to double-check what’s staged, unstaged, or untracked before committing—great for avoiding accidental file commits!

Collapse
 
preeti_yadav profile image
Preeti yadav

Absolutely! šŸ™Œ
Great tip, especially for beginners who are still getting used to Git's flow. Thanks for sharing! 😊

Collapse
 
nathan_tarbert profile image
Nathan Tarbert

pretty cool, been cool seeing steady progress - it adds up. you think habits or just showing up every day matters more for getting better at this stuff?

Collapse
 
preeti_yadav profile image
Preeti yadav

Thanks! Really appreciate that. 😊
Honestly, I think just showing up consistently builds the habit, and over time, habits make progress feel almost automatic. Even 30 focused minutes a day adds up fast. So yeah, it’s not about being perfect—just being present every day.