GitHub + Git: Push, Pull, and Pull Requests
Table of Contents
Git is the open-source command-line version control tool, and GitHub is basically just a collaboration on top of it. You can absolutely use Git without GitHub, but for most teams, GitHub (or something similar) is where a lot of the collaboration happens. Linus Torvalds created Git, and… well we don’t talk about who owns GitHub these days…
All the content from our Boot.dev courses are available for free here on the blog. This one is the “GitHub” chapter of Learn Git. If you want to try the far more immersive version of the course, do check it out!
What’s the Difference Between Git and GitHub?
Gitis the open-source CLI tool that tracks code history.GitHubis a hosted product that stores Git repos and adds collaboration features.
That means:
- Git manages your commits, branches, and merges.
- GitHub adds pull requests, UI reviews, branch protections, and remote hosting.
You can swap GitHub for GitLab or Bitbucket (or any other alternative hosting provider) and still use the same core Git commands.
How Do You Connect a Local Repo to GitHub?
Create a repo on GitHub, then add it as your remote origin:
git remote add origin https://github.com/your-username/your-repo.git
If you’re using SSH auth, you’d use the SSH URL instead.
Once connected, verify with:
git ls-remote
If remotes still feel fuzzy, read Git Remote first.
How Do You Push Local Commits to GitHub?
Use git push:
git push origin main
That sends your local main branches commits to up to the origin/main branch.
You can also push to a differently named remote branch (though tbh I usually like to keep my branches in sync):
git push origin local_branch:remote_branch
To delete a remote branch, use the --delete flag:
git push origin --delete remote_branch
What Does git pull Actually Do?
git pull is basically fetch + integrate (which can be “merge” or “rebase” depending on your preference):
git pull origin main
It grabs new remote commits and then merges (or rebases, depending on your config) into your current branch.
If you want explicit control, do it in two steps with git fetch then git merge (or git rebase). That can make debugging easier when things get weird. If you prefer rebase (as I do), then use set this config globally:
git config --global pull.rebase true
If you do, all your future pulls will integrate changes with a rebase operation by default.
What is a Pull Request?
A pull request (PR) lets you:
- show proposed changes,
- discuss them,
- run checks,
- and merge after review.
To create a PR (or in GitLab, it’s called a “merge request”, but it’s basically the same) you push a new branch to GitHub that contains your proposed changes, then open a PR to merge that branch into the target branch (often main).
To be a good citizen, you should typicall rebase your branch onto the latest main (or whatever the repo uses as the mainline) before opening the PR. That usually reduces merge pain by keeping your branch up to date, but it doesn’t guarantee a conflict-free merge if main keeps moving. It can also make a fast-forward merge possible, but whether the PR actually fast-forwards depends on repo settings and what changes land after your rebase.
What Does a Practical Team Workflow Look Like?
The lightweight version of a Git workflow for a team might look like this:
git pull origin mainto ensure you have the latest codegit switch -c my-featureto create a newmy-featurebranch- Make changes
- Commit the changes
git push origin my-featureto push the branch to GitHub- Open a PR on GitHub to merge the remote
my-featureinto remotemain - Get a review and approval from another maintainer
- Merge the PR on GitHub
All this said, if you’re working on a solo project, there’s nothing wrong with just staying on main and pushing it to the remote main directly. The PR workflow is really designed for collaboration between devs.
Frequently Asked Questions
Is GitHub the same thing as Git?
No. Git is the version control tool, while GitHub is a hosted service built around Git repositories.
What does git push do?
git push sends local commits to a remote repository branch.
What does git pull do?
git pull fetches updates from a remote and then integrates them into your current local branch.
What is a pull request?
A pull request is a proposal to merge one branch into another, usually with review and discussion before merging.
Should I commit directly to main on a team?
Usually no. Most teams use feature branches and pull requests to avoid breaking main and to enable code review.
Related Articles
Git Rebase: Keep History Linear Without Merge Commits
Apr 01, 2026 by ThePrimeagen - Ex-Netflix engineer, NeoVim ricer, and Git rebaser
If git merge feels noisy, that’s because it can be. Lots of noisy merge commits make history harder to scan, especially when you’re just trying to understand what actually changed. git rebase takes a different approach: instead of creating a merge commit, it replays your branch commits on top of the latest base commit so your history stays clean and linear.
Git Remote: Add Origin, Fetch, and Merge Remote Branches
Apr 01, 2026 by ThePrimeagen - Ex-Netflix engineer, NeoVim ricer, and Git rebaser
Git is distributed, which means your repo and my repo can both be valid “sources of truth”. In practice, teams usually pick one remote as the shared source (often GitHub) and sync local work against it… but that’s just a convention. Let’s dig into how syncing Git repositories to GitHub works, and how that’s just one way to work with Git.
Git Reset: Undo Commits With --soft and --hard
Apr 01, 2026 by ThePrimeagen - Ex-Netflix engineer, NeoVim ricer, and Git rebaser
If you’ve ever made a commit and immediately thought “noooope”, then git reset is what you need. It’s one of the most useful Git commands for undoing work, but it’s also one of the easiest to misuse. The --soft version is usually safe and predictable. The --hard version is powerful and can absolutely nuke your local changes.
Gitignore Patterns: What to Ignore and Why
Apr 01, 2026 by ThePrimeagen - Ex-Netflix engineer, NeoVim ricer, and Git rebaser
Many devs adopt the git add . (yolo, just yeet it all into the commit) workflow. It is fast, simple, and usually correct. But eventually you’ll have files in your repo directory that should never be committed: secrets, generated artifacts, dependency folders, and random local junk. That’s what .gitignore is for.