Git and GitHub for beginners starts with one simple idea: keep a record of project changes so you can understand what changed and return to an earlier version when needed. Git tracks versions on a computer; GitHub hosts Git repositories online and adds tools for sharing, reviewing and collaborating.
What is Git and what is GitHub?
Git is a version-control system that records changes to files over time. GitHub is an online platform built around Git repositories, where people can store projects, review changes and collaborate. Git can work locally without a GitHub account; GitHub provides a shared remote workspace.
Think of Git as the change-history tool and GitHub as a place to share and coordinate that history. A repository can live on your computer, on GitHub or in both places when changes are pushed and pulled.
What is a repository?
A repository, often called a repo, is a project folder that Git tracks. It contains the files in the project and the history of saved changes. A repository can include code, notes, images, documentation and configuration files, depending on the project.
For a beginner exercise, a small folder containing a README file is enough. You do not need to start with a complex software application. The goal is to practise how a change is recorded and shared.
What is a commit in Git?
A commit is a saved snapshot of selected project changes, accompanied by a message explaining what the snapshot records. Commits create a history that makes it easier to understand the sequence of work and compare the project at different points.
A useful message describes the change, such as “Add project introduction” or “Correct installation instructions.” Avoid messages like “stuff” or “final final” because they do not help a reviewer understand the history.
What is a branch in Git?
A branch is a separate line of work that lets you develop a change without immediately altering the main branch. You can create a branch for a new feature, test or correction, then merge the approved work back into the main project.
Branches are useful even for a one-person project: they keep experiments separate from the version you want to preserve. A branch does not automatically create a backup, so important work should still be committed and backed up appropriately.
What is a pull request on GitHub?
A pull request proposes that changes from one branch be reviewed and merged into another branch. It gives collaborators a place to inspect the difference, discuss improvements, run checks and agree whether the change is ready to become part of the main project.
A pull request is not the same as a commit. A commit records work in history; a pull request is a review and collaboration process around a proposed set of commits.
How does a simple Git workflow work?
A beginner workflow usually follows a short cycle: open or clone a project, create a branch, edit files, review the changes, commit them, push the branch and open a pull request when review is needed. Review the staged files before creating the commit.
- Start with a repository: create a small repository on GitHub or clone a project you have permission to use.
- Create a branch: name it after the task, such as
improve-readme. - Make one focused change: edit the README or another safe practice file.
- Review the diff: confirm the changes show only what you intended.
- Commit: write a short message that explains the change.
- Push: send your branch to the remote repository.
- Open a pull request: describe the purpose and ask for review before merging.
What do common Git commands do?
Git commands each have a specific purpose. Status shows the current working state, add stages selected changes, commit saves the staged snapshot, push sends local commits to a remote and pull brings remote changes into the current branch. Use each command only after checking the current branch.
| Command | Purpose | Beginner reminder |
|---|---|---|
git status | Shows changed and staged files. | Run it before committing. |
git add README.md | Stages one file for the next commit. | Check the file name carefully. |
git commit -m "Update README" | Records staged changes locally. | The message should describe the change. |
git push | Publishes local commits to a configured remote branch. | Confirm the destination branch. |
git pull | Fetches and integrates remote changes. | Review conflicts instead of overwriting work blindly. |
How can a beginner avoid common Git mistakes?
Keep changes small, check the working tree before committing and make sure you understand which branch is active. Never paste a password, access token or private key into a project file. Use a safe practice repository before changing a real team project.
- Do not commit every changed file automatically; inspect the diff first.
- Do not store passwords or private credentials in a public repository.
- Do not force-push or rewrite shared history unless the team explicitly agrees.
- Pull and understand existing changes before starting work on an active shared project.
- Use a descriptive branch name and commit message.
Practice task: make a small change safely
Create a practice repository containing a README with a project name and two-sentence description. Create a branch named add-project-summary, add one extra section, review the diff, commit the change and push the branch. Open a pull request if you have a GitHub account.
Before finishing, answer these questions in your own words: Which file changed? What does the commit record? Which branch contains the change? Has it been merged into the main branch yet? These checks connect the vocabulary with the actual workflow.
Quick review
- Git records project history; GitHub hosts repositories and supports collaboration.
- A repository contains project files and version history.
- A commit records selected changes.
- A branch separates a line of work.
- A pull request proposes changes for review and merge.
Frequently asked questions
Do I need GitHub to use Git?
No. Git is a version-control tool that can track changes on your own computer. GitHub is an online platform for hosting Git repositories and collaborating. You can learn commits and branches locally first, then use GitHub when you need to share work.
Is GitHub the same as cloud storage?
Not exactly. GitHub stores repositories online, but its main purpose is version control and collaboration rather than general file storage. Commits record changes and pull requests support review. Use a suitable backup service for files that need separate backup protection.
What is the difference between a commit and a push?
A commit saves staged changes to the local repository's history. A push sends local commits to a remote repository such as GitHub. You can make several commits before pushing them, and the remote copy will not receive them until you push.
Why should I create a Git branch?
A branch lets you work on a task without immediately changing the main line of work. You can test an idea, make commits and request review. When the work is ready, it can be merged according to the project's workflow.
Can I learn Git without using the command line?
Yes. GitHub Desktop provides a graphical way to perform common Git tasks such as cloning, creating branches, reviewing changes, committing and pushing. Learning basic command names is still useful because tutorials and troubleshooting guides often use them. Always confirm the repository's current workflow and permissions.
Key takeaway
Git helps you record and manage project changes, while GitHub makes it easier to share and review those changes online. Begin with a small repository, make focused commits, use branches for separate tasks and check every change before sharing it.