DEV Community

Cover image for Simple Git and GitHub Commands for Beginners
Mahmudur Rahman
Mahmudur Rahman

Posted on • Edited on

2 1 1 1 1

Simple Git and GitHub Commands for Beginners

Git and GitHub may seem a bit intimidating at first, but there’s no need to worry! Here’s a handy list of essential commands to help you smoothly get started. 💻✨

1. Setup Your Identity

Before doing anything, let Git know who you are:

git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
Enter fullscreen mode Exit fullscreen mode

2. Initialize a Repository

Start tracking your project:

git init
Enter fullscreen mode Exit fullscreen mode

3. Check the Status

Know what’s happening in your repository:

git status
Enter fullscreen mode Exit fullscreen mode

4. Add Files to Staging Area

Prepare your changes for a commit:

git add .
Enter fullscreen mode Exit fullscreen mode

5. Commit Your Changes

Save your progress with a message:

git commit -m "Initial commit"
Enter fullscreen mode Exit fullscreen mode

6. Connect to a Remote Repository

Link your local repository to GitHub:

git remote add origin https://github.com/yourusername/your-repo.git
Enter fullscreen mode Exit fullscreen mode

7. Push Your Code to GitHub

Upload your changes:

git push -u origin main
Enter fullscreen mode Exit fullscreen mode

8. Clone a Repository

Copy an existing repository to your local machine:

git clone https://github.com/username/repository.git
Enter fullscreen mode Exit fullscreen mode

9. Pull Latest Changes

Stay updated with the remote repository:

git pull origin main
Enter fullscreen mode Exit fullscreen mode

10. View Commit History

Check what’s been done:

git log
Enter fullscreen mode Exit fullscreen mode

Pro Tip 💡

If you're unsure, git status is your best friend!


With these commands, you’re ready to start your Git and GitHub journey. Happy coding! 🚀


Follow for more!

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay