DEV Community

Philip Weit
Philip Weit

Posted on

Git Basics for Beginners: Push, Pull, and Track Changes

What Is Git?

Git is a tool that helps you track changes in your files. It lets you save versions of your work and go back if something breaks.
GitHub is where your Git projects are stored online.

What Is Git Bash?

Git Bash is a terminal for Windows that allows you to use Git commands to manage your projects.

Starting a Git Project

Go to your project folder:

cd path/to/project

Enter fullscreen mode Exit fullscreen mode

Start Git tracking:

git init
Enter fullscreen mode Exit fullscreen mode

Tracking and Saving Changes

Check file status:

git status
Enter fullscreen mode Exit fullscreen mode

Stage files:

git add .
Enter fullscreen mode Exit fullscreen mode

Save changes:

git commit -m "My first commit"
Enter fullscreen mode Exit fullscreen mode

A commit saves a version of your work.

Push Code to GitHub

Connect your project to GitHub:

git remote add origin git@github.com:username/repo-name.git
Enter fullscreen mode Exit fullscreen mode

Upload your code:

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

Pull Updates from GitHub

Get the latest changes:

git pull origin main
Enter fullscreen mode Exit fullscreen mode

Simple Git Workflow

  1. Edit files
  2. git add .
  3. git commit -m "message"
  4. git push

Conclusion

Git helps beginners manage projects safely and build a GitHub portfolio. Once you understand the basics, it becomes an essential everyday tool.

This article was written as part of my data analytics bootcamp to document my learning journey with Git and GitHub.

Top comments (0)