Skip to content
Web Development

Git and GitHub for Beginners: Commands & Workflow

Learn what Git and GitHub are, the essential Git commands, a simple branching workflow, pull requests and how to publish a website with GitHub Pages.

Git and GitHub: developer desk with VS Code and a terminal open
Quick answer

Git is version control software that tracks changes to your code on your own computer. GitHub is an online platform that hosts Git repositories so you can back up code, collaborate and review changes with pull requests. The basic workflow is: edit files, git add them, git commit with a message, and git push to GitHub. Use branches for new features and merge them through pull requests.

Every developer — and many designers and content teams — should know Git. It protects your work, records why changes were made and makes collaboration safe. This guide covers the essentials.

Git vs GitHub

GitGitHub
What it isVersion control softwareOnline hosting and collaboration platform for Git repositories
Where it runsOn your computerIn the cloud (github.com)
Main featuresCommits, branches, merges, historyRemote repositories, pull requests, issues, Actions, Pages
Alternatives—GitLab, Bitbucket

Set up Git

01

Install Git

Download it from git-scm.com (it is included with many developer tools on macOS and Linux).

02

Set your name and email

These are recorded with every commit.

03

Create a GitHub account

Then add an SSH key or use GitHub CLI / your editor for authentication.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

Essential Git commands

git init                      # start tracking a project
git status                    # see changed files
git add index.html            # stage a file (or: git add .)
git commit -m "Add homepage"  # save a snapshot with a message
git log --oneline             # view history
git remote add origin git@github.com:you/my-site.git
git push -u origin main       # upload to GitHub
git pull                      # get the latest changes
git clone <url>               # copy an existing repository

A simple branching workflow

01

Create a branch

git switch -c feature/contact-form

02

Commit your work

Make small commits with clear messages.

03

Push the branch

git push -u origin feature/contact-form

04

Open a pull request

On GitHub, describe the change and ask for review.

05

Merge and update

After review, merge into main, then git switch main and git pull.

Ignore files that should not be committed

A .gitignore file lists files Git should skip, such as dependencies, build output and secrets.

# .gitignore
node_modules/
dist/
.env
*.log

Important: Never commit passwords, API keys or .env files. If a secret is pushed to GitHub, revoke and replace it immediately — deleting the commit is not enough.

Publish a website with GitHub Pages

GitHub Pages hosts static websites (HTML, CSS and JavaScript) for free from a repository. Push your site to GitHub, open Settings → Pages, choose the branch and folder, and your site goes live at username.github.io/repository. You can also connect a custom domain.

Git in WordPress and design work

Git is ideal for theme and plugin code. For WordPress, track your custom theme or plugin folders rather than the whole site, and use proper backups for the database and uploads.

Go deeper with how to use Git and GitHub for beginners, and set up a good code editor with Git integration.

Keep learning

More in Web Development

HTML

Learn how HTML structures modern websites — from document basics and semantic elements to forms, media, accessibility, SEO and practical…

CSS

Learn how CSS controls the appearance, layout, responsiveness and visual behaviour of modern websites — from selectors and the box…

JavaScript

Learn JavaScript from the fundamentals to DOM manipulation, events, functions, asynchronous programming, APIs, modules, browser storage and modern frontend development.

PHP

Learn PHP from the fundamentals to server-side programming, forms, databases, APIs, object-oriented programming, WordPress development, security and modern backend development.

React

Learn React from the fundamentals to components, JSX, props, state, hooks, forms, APIs, performance, accessibility, testing and modern frontend application…

Angular

A beginner-friendly Angular tutorial: what Angular is, how components, signals and services work, how to start a project and when…

Vue

Learn Vue.js 3 step by step: create a project, build single-file components, use reactive state with the Composition API and…

Next.js

Learn Next.js step by step: the App Router, Server Components, rendering options, metadata for SEO, images and how to build…

Latest articles

Related Web Development articles

FAQ

Git and GitHub: your questions answered

Short, honest answers to the questions people ask most about this topic.

Is Git the same as GitHub?

No. Git is version control software you run locally. GitHub is a website that hosts Git repositories and adds collaboration features such as pull requests, issues and automation.

Yes, GitHub offers free accounts with unlimited public and private repositories. Paid plans add advanced team features, more Actions minutes and enterprise controls.

A pull request proposes merging changes from one branch into another. Teammates can review the code, comment and run automated checks before the change is merged.

It helps, especially for designers who write front-end code. Basic commands such as add, commit, push and pull are enough for most design workflows.

Next step

Keep building your skills

Explore the rest of our Web Development guides, or follow the beginner path step by step.