Mar 26, 2026
--:--:--
🌧️
26.1°C
Breaking News
Loading breaking news...

Git and GitHub for Beginners: A Friendly Guide

M

Mershal Editorial Team

Staff Writer

3 min read
Git and GitHub for Beginners: A Friendly Guide

Learn Git and GitHub with this beginner-friendly guide filled with tips, tricks, and real-world examples.

So you want to learn about Git and GitHub? Dude, I've been meaning to write about this for a while now. I struggled with this for months, so here's what I learned after tons of trial and error. Honestly, it took me weeks to figure this out, but I promise you’ll get it faster! 😊

When I first tried Git, I made this stupid mistake of not committing my changes regularly. Spoiler alert: it took me 3 hours to debug what was a typo. But, let’s not dwell on that. Here’s what actually worked for me after tons of trial and error.

Getting Started with Git

First, you'll want to install Git. Whether you’re on Windows, macOS, or Linux, the official Git website has all the download instructions. Pro tip from someone who's been there: double-check your installation path, or you might end up installing it multiple times. 😅

Once you've got Git installed, open your terminal (or Git bash on Windows). Here's the code that finally worked for me to configure my user details:

git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"

Copy-paste this, trust me. Don't make my mistake - here's the correct way!

Creating a Local Repository

Alright, now let's create a local repository. In my latest project, I used this to keep track of my code changes. Navigate to your project folder and initiate a Git repository:

git init

This snippet saved my project. Hope it helps you too! 🎉

Basic Git Commands

Btw, I wrote about basic Git commands last week - check it out! The most common ones you'll use are:

  • git add . - stages all changes
  • git commit -m "Your commit message" - commits changes
  • git status - checks the status of your repo

After that, you’ll be able to track your project like a pro.

Pushing to GitHub

When building MyAwesomeApp, I had to push my local changes to GitHub. Here’s how you can do it too:

git remote add origin https://github.com/username/repository.git
git push -u origin master

One more thing before I forget, make sure your repository on GitHub is empty without any README file or license. Otherwise, you might get conflicts.

Troubleshooting Common Issues

I still remember the frustration of working with merge conflicts. If you’re like me, you’ve probably wondered how to resolve them. I personally prefer using git mergetool because it simplifies the process. This actually happened in production last month, and it was a lifesaver!

Conclusion

Try this out and let me know how it goes! Drop a comment if you get stuck anywhere. I’m not an expert, but here’s what worked for me. And hey, feel free to correct me in the comments if there’s a better approach.

If you enjoyed this, you might like my post on advanced Git techniques. I’ll update this post if I find something better. Happy coding! 🎉

Share This Article

Related Articles