Skip to content
Discussion options

You must be logged in to vote

Both commands are used to download changes from a remote repository, but they do it in different ways:

1. git fetch (Safe & Non-Destructive)

  • What it does: It downloads new commits, files, and branches from the remote repository to your local machine, but does not merge them into your active local working files.
  • When to use: Use this when you want to see what your teammates have done without modifying your current local code. You can inspect the fetched changes using git log or git diff origin/main.

2. git pull (Fetch + Merge)

  • What it does: It is a shortcut that does two things in one step:
    1. Runs git fetch to download the changes.
    2. Runs git merge to immediately merge those changes into y…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by muhammedadnank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants