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.

397 questions
37 answers

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

What are the differences between git pull and git fetch?
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
52 answers

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

How do I force an overwrite of local files on a git pull? My local repository contains a file of the same filename as on the server. error: Untracked working tree file 'example.txt' would be overwritten by merge
Jakub Troszok
  • 99,267
  • 11
  • 41
  • 53
31 answers

`git fetch` a remote branch

The remote repository contains various branches such as origin/daves_branch: $ git branch -r origin/HEAD -> origin/master origin/daves_branch origin/master How do I switch to daves_branch in the local repository so that it tracks…
  • 34,836
  • 11
  • 47
  • 77
19 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…
  • 42,592
  • 75
  • 224
  • 366
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,444
  • 70
  • 209
  • 362
12 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
  • 17,203
  • 7
  • 34
  • 36
17 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?
  • 4,425
  • 2
  • 23
  • 12
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?
  • 106,540
  • 116
  • 246
  • 346
12 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
  • 4,296
  • 3
  • 27
  • 34
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…
  • 12,528
  • 9
  • 64
  • 96
8 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
  • 166,356
  • 226
  • 505
  • 746
7 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
  • 20,936
  • 12
  • 75
  • 93
11 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
  • 3,050
  • 4
  • 23
  • 33
2 answers

Differences between git remote update and fetch?

Is git remote update the equivalent of git fetch?
  • 2,533
  • 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?
  • 7,433
  • 4
  • 36
  • 61
2 3
26 27