Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+17 votes
asked in CSC305 Fall 2022 by (1 point)

2 Answers

+7 votes

When you do: git fetch , it fetches all the branches from the repository meanwhile when you do: git fetch , it fetches the specified branch

Here is the website that I use to find a lot about git related topics:
https://www.atlassian.com/git/tutorials/syncing/git-fetch

Hope this helps.

answered by (1 point)
+7 votes

git fetch downloads the commits from the remote repository so they are included in your local repo, but it doesn't change your local branch.

e.g., if you are working on the main branch, if you do a git fetch from GitHub then your teammates' code will get fetched into your repo, but your files in your working directory won't change, and your HEAD and main will still point to the same place they did before you fetched.

If you do a git pull, then git performs a git fetch first, and THEN a git merge that attempts to merge the remote changes with yours. (It may do a fast-forward merge if you haven't made any changes.)

answered by (508 points)
...