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
23
votes
2 answers

What does git fetch exactly do?

Edit: I have checked this What does FETCH_HEAD in Git mean? before asking the question. Sorry for the original inaccurate question. My question is how does fetch really work? Does fetch drop all current log? This is my situation: my teammates…
HarryTheF
  • 299
  • 1
  • 4
  • 11
23
votes
3 answers

How to git fetch and checkout without creating a remote branch locally?

Use Case: I have some repo on GitHub, someone forked it and added new feature and initiated pull request. I can't automatically merge it because there are some minor problems I would like to fix first. It's one-time activity I'll never need this…
Alex Craft
  • 13,598
  • 11
  • 69
  • 133
22
votes
3 answers

Git fetch and pull with no arguments

I have a git branch checked out named foo. > git status # On branch foo nothing to commit (working directory clean) It was originally checked out using this command: > git checkout origin/foo -b foo --track I want to get updates to this branch…
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
22
votes
4 answers

Why does git log not show anything new after git fetch?

I am learning about working with Git remotes by reading the relevant section of the Pro Git Book. If you clone a repository, the command automatically adds that remote repository under the name "origin". So, git fetch origin fetches any new work…
Adil
  • 2,418
  • 7
  • 34
  • 38
19
votes
7 answers

How to fix git repository broken by interrupted git fetch?

If git fetch gets interrupted for example by Ctrl-C or caused by connectivity problems, after that git fetch and also git pull fail to work. user@computer:~/code/openttd-git$ git fetch ^C user@computer:~/code/openttd-git$ git fetch error: Unable to…
nrz
  • 10,435
  • 4
  • 39
  • 71
18
votes
2 answers

Understanding .git/config's 'remote' and 'branch' sections

Here's the contents of the remote and branch sections of my .git/config file. [remote "origin"] url = https://EvanAad@bitbucket.org/EvanAad/bitbucketstationlocations.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] …
Evan Aad
  • 5,699
  • 6
  • 25
  • 36
18
votes
3 answers

Git: How does git svn fetch work?

How does git svn fetch work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because git remote doesn't give me anything on my git svn repository?
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
17
votes
2 answers

Git push fails to github: failed to read object

The story: I've been developing a RoR-app in both my desktop and laptop. It was quite handy to commit changes made on another, push them to github and fetch & merge on other. The starting point is this: I committed latest changes on my desktop,…
Teemu Vainio
  • 171
  • 1
  • 4
17
votes
5 answers

pull-only repo's 'git status' saying the branch is ahead of origin/master. Why?

So here's the situation: $ git status # On branch master # Your branch is ahead of 'origin/master' by [x] commits. # There are several questions about this on SO already, but none seem to specifically address the type of scenario I have. This…
JK Laiho
  • 3,538
  • 6
  • 35
  • 42
17
votes
1 answer

some confusion on git pull vs git-fetch

So - can someone clarify this one: I run: git pull origin master git status And it then pulls the changes and says: your branch is ahead of origin/master ... blahblah by 6 commits... When I then run git fetch git status It says: # On branch…
Dannyboy
  • 1,963
  • 3
  • 20
  • 37
16
votes
4 answers

Git pull/fetch with refspec differences

Using refspec is a convenient way to grab a remote branch and create a similar one but with given name (or the other way round: create a remote one with a given name different from the local one). I'm puzzled about one tiny thing - as pull will also…
pielgrzym
  • 1,647
  • 3
  • 19
  • 28
14
votes
1 answer

What use does the --append option in git fetch command?

While looking at the documentation for git fetch I noticed the --append option. The documentation says it does this: Append ref names and object names of fetched refs to the existing contents of .git/FETCH_HEAD. Without this option old data in…
Yazeed Sabri
  • 346
  • 3
  • 17
14
votes
2 answers

Git "Fetch URL" and "Push URL", whats the difference?

When would the Fetch URL and Push URL not be the same for a certain remote? For example, when i run git remote show central for a remote named central, the output looks like: * remote central Fetch URL:…
Ankur
  • 2,792
  • 3
  • 23
  • 26
14
votes
1 answer

fetch and checkout a remote git branch in just one command

If I have local repo with a remote $REMOTE already set up and a new branch $BRANCH exists on the remote repo that I haven't fetched, yet can I fetch that branch and check it out into a tracking local branch of the same name in a single command? I…
das-g
  • 9,718
  • 4
  • 38
  • 80
14
votes
4 answers

Git fetch hangs on git-upload-pack

Seemingly at random, our local repos can no longer fetch from our Bonobo server. It happens with our biggest remote repo (about 4GB) to different people and at different times, when we try to fetch locally. At first it was just every few months, but…
Stefano
  • 1,686
  • 1
  • 16
  • 25