Pulling a branch from GitHub allows you to fetch and merge the latest changes from a specific remote branch into your local repository, keeping your work synchronized with collaborators.
Git pulls changes from a remote branch and integrates them into the current branch.
// Pull a specific branch from a remote repository
git pull origin feature-xyz
Fetching updates first lets you review changes before merging.
// Fetch all remote branches without merging
git fetch origin
If the branch doesn’t exist locally, create and track it.
// Create and switch to a local branch tracking remote
git checkout -b feature-xyz origin/feature-xyz
Rebasing keeps commit history linear and clean.
// Pull changes using rebase instead of merge
git pull --rebase origin feature-xyz
// List all local branches
git branch
// List remote branches
git branch -r
// List all branches
git branch -a
--rebase