DEV Community

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

Posted on • Edited on

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 Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay