Questions tagged [git-fetch]

git-fetch - Download objects and refs from another repository

The git command fetch retrieves changes done in a remote repository.

It will not merge the changes automatically into your local branches, use git pull for this or merge from the origin-branch after doing fetch.

See the man page for full details.

368 questions
38 answers

What is the difference between 'git pull' and 'git fetch'?

What are the differences between git pull and git fetch?
  • 264,618
  • 120
  • 339
  • 573
48 answers

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? The scenario is the following: A team member is modifying the templates for a website we are working on They are adding some images to the images directory (but forgets to add them under…
Jakub Troszok
  • 90,015
  • 10
  • 37
  • 51
31 answers

Git fetch remote branch

My colleague and I are working on the same repository. We've branched it into two branches, each technically for different projects, but they have similarities, so we'll sometimes want to commit back to the *master from the branch. However, I have…
  • 30,824
  • 10
  • 42
  • 70
17 answers

The following untracked working tree files would be overwritten by merge, but I don't care

On my branch I had some files in .gitignore On a different branch those files are not. I want to merge the different branch into mine, and I don't care if those files are no longer ignored or not. Unfortunately I get this: The following untracked…
  • 39,120
  • 70
  • 217
  • 364
7 answers

fetch from origin with deleted remote branches?

When I do git fetch origin and origin has a deleted branch, it doesn't seem to update it in my repository. When I do git branch -r it still shows origin/DELETED_BRANCH. How can I fix this?
Chris Muench
  • 17,182
  • 66
  • 197
  • 341
2 answers

What is the difference between git pull and git fetch + git rebase?

Another question says that git pull is like a git fetch + git merge. But what is the difference between git pull and git fetch + git rebase?
  • 98,154
  • 113
  • 236
  • 338
11 answers

fetch in git doesn't get all branches

I have cloned a repository, after which somebody else has created a new branch, which I'd like to start working on. I read the manual, and it seems dead straight easy. Strangely it's not working, and all the posts I've found suggest I'm doing the…
Edward Newell
  • 14,416
  • 5
  • 32
  • 36
6 answers

Does "git fetch --tags" include "git fetch"?

A nice and simple question - is the function of "git fetch" a strict sub-set of git fetch --tags? I.e. if I run git fetch --tags, is there ever a reason to immediately run git fetch straight afterward? What about git pull and git pull --tags? Same…
  • 10,972
  • 8
  • 56
  • 83
11 answers

Why does git say "Pull is not possible because you have unmerged files"?

When I try to pull in my project directory in the terminal, I see the following error: harsukh@harsukh-desktop:~/Sites/branch1$ git pull origin master U app/config/app.php U app/config/database.php U app/routes.php Pull is not possible because you…
Harsukh Makwana
  • 3,818
  • 3
  • 24
  • 31
7 answers

What does FETCH_HEAD in Git mean?

git pull --help says: In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD. What is this FETCH_HEAD and what is actually merged during git pull?
Misha Moroshko
  • 155,631
  • 217
  • 478
  • 716
10 answers

How to handle git gc fatal: bad object refs/remotes/origin/HEAD error?

I randomly hit this today while trying to run Git garbage collect: $ git gc fatal: bad object refs/remotes/origin/HEAD error: failed to run repack How do I deal with this?
  • 3,325
  • 2
  • 17
  • 11
5 answers

Is it possible to pull just one file in Git?

I am working on a Git branch that has some broken tests, and I would like to pull (merge changes, not just overwrite) these tests from another branch where they are already fixed. I know I can do git pull origin that_other_branch but this will…
Audrius Meškauskas
  • 19,714
  • 10
  • 68
  • 84
10 answers

Retrieve specific commit from a remote Git repository

Is there any way to retrieve only one specific commit from a remote Git repo without cloning it on my PC? The structure of remote repo is absolutely same as that of mine and hence there won't be any conflicts but I have no idea how to do this and I…
Varun Chitre
  • 2,791
  • 4
  • 19
  • 31
2 answers

Differences between git remote update and fetch?

Is git remote update the equivalent of git fetch?
  • 2,463
  • 2
  • 18
  • 16
2 answers

How do I fetch a branch on someone else's fork on GitHub?

I've forked from a repo on GitHub. I want to get the code from a branch on another user's fork. Must I clone this user's whole repo to a separate local repo or can I do something like git checkout link_to_the_other_users_branch?
  • 6,814
  • 4
  • 31
  • 53
2 3
24 25