Git & GitHub Interview Question #33
What does git pull do?
Remotes, Fetch, Pull, Push, Merge, Conflicts, Rebase & Stash Junior Beginner
Quick Interview Answer
git pull retrieves changes from a remote and then integrates them into the current branch. By default this commonly means fetch followed by merge, although configuration or command options can make pull use rebase instead.
Detailed Explanation
git pull retrieves changes from a remote and then integrates them into the current branch. By default this commonly means fetch followed by merge, although configuration or command options can make pull use rebase instead.
Because pull performs integration as well as downloading, developers should understand their team's merge or rebase policy before using it automatically.
Code Example
git pull origin main
# Pull and rebase instead of merging
git pull --rebase origin main