Git and GitHub for Beginners: Practical Workflow

Reading Time8 min readIn-Depth Technical Guide
Published DateOctober 30, 2026Verified Editorial Content
Article CategoryWeb DevelopmentIndustry Insights & Skills
Authored ByHamzaProfessional Trainer
Git and GitHub beginner workflow showing commits, branches, pull requests and version control
Git and GitHub for beginners showing version control and code collaboration symbolsFeatured Article

Imagine spending hours building a website, only to accidentally delete an important piece of code. Or working on a team project where everyone makes changes to the same files. How do developers keep their work organized without losing progress?

This is where Git and GitHub become useful.

Git helps developers track changes to their code, while GitHub provides an online platform for storing repositories, collaborating with others, and reviewing contributions.

If you are learning web development, understanding Git and GitHub for beginners is an important step toward managing projects professionally.

This guide explains essential concepts, common commands, and a practical workflow you can follow while building your first development projects.

What Is Git?

Git is a distributed version control system that records changes made to files over time.

Instead of creating separate folders named "final," "final-new," and "final-updated," developers can use Git to maintain an organized history of their work.

Git allows you to review previous changes, create separate development branches, and return to earlier versions when necessary.

Why Do Developers Use Git?

Git is useful for both individual and team projects.

Its main benefits include:

  • Tracking changes to source code

  • Recording important development milestones

  • Experimenting without directly changing the main project

  • Identifying when particular changes were introduced

  • Supporting collaboration between developers

  • Maintaining an organized project history

For example, if you are developing a personal portfolio website, Git can track changes to your homepage, navigation, styling, and contact form.

What Is GitHub?

GitHub is an online platform for hosting Git repositories and supporting software development collaboration.

Git operates on your computer, while GitHub allows you to share repositories online and coordinate changes with other developers.

GitHub also provides features such as pull requests, issues, discussions, and automated development workflows.

Git vs GitHub: What's the Difference?

Although their names are similar, Git and GitHub are not the same thing.

FeatureGitGitHub
Primary PurposeVersion controlRepository hosting and collaboration
Works LocallyYesMainly provides online services
Tracks Code ChangesYesDisplays Git history
Supports BranchesYesProvides branch management interfaces
Code ReviewThrough Git tools and workflowsPull requests and review features
Internet RequiredNot for local operationsRequired for online collaboration

You can use Git without GitHub. However, combining them provides a convenient workflow for managing and sharing development projects.

Essential Git and GitHub Terms for Beginners

Before using commands, understand the basic terminology.

Repository

A repository is a project containing files and Git version history.

A repository may exist locally on your computer or remotely on a hosting platform.

Commit

A commit records a snapshot of selected project changes.

Each commit includes identifying information and a message explaining what changed.

Branch

A branch provides a separate line of development.

Developers commonly create branches when adding features or fixing problems without immediately changing the main branch.

Remote

A remote is a named connection to another Git repository.

The default name for a remote created during cloning is commonly origin.

Pull Request

A pull request is a GitHub feature used to propose changes from one branch into another.

It allows developers to review code, discuss improvements, and perform checks before merging changes.

How to Install and Configure Git

Before creating your first repository, install Git on your computer.

Git is available for Windows, macOS, and Linux.

After installation, open a terminal and check whether Git is available.

Check the installed version:

git --version

If Git is installed correctly, the terminal should display its version information.

Configure Your Git Identity

Git uses a name and email address to identify the author of commits.

Set these using:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

Replace the example values with your own information.

These settings become the default identity for commits unless overridden for a particular repository.

How to Create Your First Git Repository

You can begin practicing Git using a small website project.

Step 1: Create a Project Folder

Create a folder named my-first-website and add a basic HTML file.

Open the folder in a terminal or code editor.

Step 2: Initialize Git

Run:

git init -b main

This initializes a repository with main as its initial branch.

Git creates a hidden .git directory containing repository information.

Step 3: Check Repository Status

Run:

git status

This command shows modified, staged, and untracked files.

It is one of the most useful commands for understanding your current working directory.

Step 4: Stage Your Changes

Run:

git add index.html

Staging selects the changes you want to include in the next commit.

You can also stage all relevant changes with git add ., but review the files first to avoid accidentally including sensitive information.

Step 5: Create Your First Commit

Run:

git commit -m "Add initial homepage"

Your changes are now recorded in the repository history.

You can view previous commits using:

git log --oneline

How to Upload a Project to GitHub

Once your local repository contains a commit, you can connect it to GitHub.

Step 1: Create a GitHub Repository

Sign in to GitHub and create a new repository.

For this example, name it my-first-website.

If your local repository already contains files, create the remote repository without automatically adding a README or other initial files.

Step 2: Connect the Remote Repository

Use the repository URL provided by GitHub:

git remote add origin https://github.com/USERNAME/my-first-website.git

Replace USERNAME with your actual GitHub username.

Step 3: Push Your Code

Run:

git push -u origin main

This uploads your local main branch and establishes its upstream connection.

GitHub may require authentication through an approved sign-in method or credential manager.

After the push succeeds, your committed files should appear in the GitHub repository.

Understanding Branches and Practical Development Workflows

Branches allow developers to work on changes separately.

For example, suppose your portfolio website needs a new contact form.

Instead of immediately editing the main branch, you can create a feature branch.

Create a Feature Branch

Run:

git switch -c feature/contact-form

This creates and switches to a new branch.

You can now modify the website without directly changing the main branch.

Commit Your Work

After completing and reviewing the feature, use:

git add .

git commit -m "Add contact form layout"

Then publish the branch:

git push -u origin feature/contact-form

The branch becomes available on GitHub for review.

How Pull Requests Work on GitHub

A pull request allows developers to propose merging changes into another branch.

After pushing your feature branch, open the repository on GitHub and create a pull request targeting main.

A typical pull request workflow involves:

  1. Writing a clear title and description

  2. Explaining what changed and why

  3. Reviewing the modified files

  4. Running relevant checks or tests

  5. Addressing feedback

  6. Merging after approval

After the pull request is merged, update your local main branch.

Run git switch main, followed by git pull --ff-only origin main.

This keeps your local branch aligned with the remote version when a fast-forward update is possible.

Essential Git Commands Every Beginner Should Know

The following commands cover many everyday development tasks.

Git CommandPurpose
git initInitialize a repository
git clone URLDownload a repository
git statusCheck working directory status
git addStage selected changes
git commitRecord staged changes
git logView commit history
git switchChange branches
git switch -cCreate and switch to a branch
git pullFetch and integrate remote changes
git pushUpload local commits
git diffExamine code differences

Beginners do not need to memorize every Git command immediately.

Learning the commands through practical projects makes them easier to remember.

Common Git and GitHub Mistakes Beginners Make

Several mistakes can create confusion or unnecessary risks.

Committing sensitive information: Never commit passwords, API keys, or private credentials. Use suitable environment configuration and .gitignore rules.

Using unclear commit messages: Messages such as "update" provide little context. Describe the actual change.

Working only on the main branch: Feature branches help separate experimental changes and support review.

Ignoring Git status: Check repository status before staging or committing files.

Using force push carelessly: Force pushing can overwrite remote history. Avoid it on shared branches unless you fully understand the consequences.

Confusing commits with pushes: A commit records changes locally, while pushing transfers commits to a remote repository.

Developing careful habits makes collaboration and troubleshooting easier.

A Practical Two-Week Git and GitHub Learning Roadmap

Beginners can develop confidence through a simple practice schedule.

TimelineLearning FocusPractical Assignment
Days 1–3Git installation and repository basicsCreate a repository and first commit
Days 4–6Staging, commits, and historyTrack several website changes
Days 7–9GitHub repositories and remote connectionsPublish a project to GitHub
Days 10–12Branches and pull requestsDevelop a feature branch
Days 13–14Collaboration and reviewComplete a pull request workflow

This schedule is an introduction rather than a guarantee of proficiency.

The most valuable practice comes from using Git regularly while developing real projects.

Learners exploring broader software development skills can also review the web development courses at GS Trainings, including frontend and full stack development programs.

Conclusion

Git and GitHub are valuable tools for organizing code, tracking project changes, and collaborating with other developers.

Git provides local version control, while GitHub supports online repository hosting, pull requests, and team-based development.

Beginners should focus on understanding repositories, commits, branches, and remote connections before exploring more advanced workflows.

By practicing these concepts through small projects, you can develop reliable version control habits that support long-term growth in software development.

Frequently Asked Questions

No. Git is a version control system that tracks file changes. GitHub is an online platform that hosts Git repositories and provides collaboration features.

Hamza
Written byHamzaProfessional Trainer
Share:
GS Trainings Masterclasses

Turn Knowledge into Execution

Get hands-on training with verifiable projects in our next professional cohort.