What is the difference between git pull and git fetch?
- git fetch: It retrieves changes from a remote repository but does not apply them to
your working directory. You can think of it as checking for updates without actually
installing them.
- git pull: This does two things: it fetches the latest changes and then merges them
into your current branch. It's like fetching updates and immediately applying them.
Real-World Example:
If you're working on a project with teammates, git fetch allows you to see what changes
have been made without affecting your code. git pull, on the other hand, will update your
local copy and merge those changes with your work, which can sometimes result in merge
conflicts.