Loading lessons...
Pull from GitHub
Pull from GitHub
git pull brings new commits from the remote down to your local repository.
The pull command
git pull
This downloads the latest changes from origin and merges them into your current branch.
What pull really does
git pull is actually two steps combined:
git fetch
git merge
- fetch downloads the remote commits.
- merge joins them into your branch.
Pull before you push
Before pushing, it is good practice to pull first. If someone else pushed changes, pulling makes sure you are up to date, which avoids conflicts.
A conflict warning
If you and someone else changed the same lines, a pull can create a merge conflict that you need to fix manually.
Pull a specific branch
git pull origin main
TL;DR
git pulldownloads and merges remote commits.- It combines
git fetchandgit merge. - Pull before pushing to stay up to date.
- Pulls can trigger merge conflicts to resolve.