###### Table of Contents - [[]] - [[]] - [[]] - [[]] # git fetch The `git fetch` command downloads commits, files, and refs from a remote repository into your local repo. Fetching is what you do when you want to see what everybody else has been working on, but it doesn’t force you to actually merge the changes into your repository. Git isolates fetched content from existing local content; it has absolutely no effect on your local development work. Fetched content has to be explicitly checked out using the `git checkout` command. This makes fetching a safe way to review commits before integrating them with your local repository. When downloading content from a remote repo, `git pull` and `git fetch` commands are available to accomplish the task. You can consider `git fetch` the 'safe' version of the two commands. It will download the remote content but not update your local repo's working state, leaving your current work intact. `git pull` is the more aggressive alternative; it will download the remote content for the active local branch and immediately execute `git merge` to create a merge commit for the new remote content. If you have pending changes in progress this will cause conflicts and kick-off the merge conflict resolution flow. ## Git fetch commands and options Fetch all of the branches from the repository. This also downloads all of the required commits and files from the other repository. ```zsh git fetch origin ``` Same as the above command, but only fetch the specified branch. ```zsh git fetch origin main ``` ### Check to see if pull needed in Git [](https://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git#answer-12791408) ```zsh git fetch origin main git status ``` ### Git Fetch Pull Request (Bitbucket) ```bash git fetch ``` ```bash git checkout -b PRJ-1234 origin/PRJ-1234 ``` [BitBucket: Git Fetch Pull Request](https://www.atlassian.com/git/articles/pull-request-proficiency-fetching-abilities-unlocked) #### More info [Git Fetch - Bitbucket](https://www.atlassian.com/git/tutorials/syncing/git-fetch) ___ **Tags**: #git-fetch