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
180
votes
10 answers

Git: How to pull a single file from a server repository in Git?

I am working on a site with a server running Git. I am using Git for deployment (not GitHub). This was set up prior to my involvement using a hook method, and I referred to this question and entered the commands below, but it didn't work. How do I…
vsvs
  • 1,975
  • 2
  • 12
  • 14
171
votes
3 answers

How to update a git clone --mirror?

I have created a git repository to mirror a live site (which is a non-bare git repository): git clone --mirror ssh://user@example.com/path/to/repo Now, to keep this mirror clone updated with all changes from its remote origin, which command or…
J. Bruni
  • 20,322
  • 12
  • 75
  • 92
155
votes
8 answers

Trying to pull files from my Github repository: "refusing to merge unrelated histories"

I'm learning git, and I'm following the Git community book. Previously (long time ago) I made a public repository on Github, with some files. Now I set up a local Git repository on my current computer, and committed some files. Then I added a…
MichaelSB
  • 3,131
  • 3
  • 26
  • 40
139
votes
13 answers

Git: How to check if a local repo is up to date?

I would like to know if my local repo is up to date (and if not, ideally, I would like to see the changes). How could I check this without doing git fetch or git pull ?
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
136
votes
4 answers

Git removing upstream from local repository

I am working with a ruby on rails application and I am trying to sync a fork. It is worth mentioning that I am also on a Mac. I committed the following action: $ git remote -v to get a view of my local repository. I messed up when trying to go…
user2603138
  • 1,397
  • 2
  • 10
  • 10
119
votes
5 answers

How Do I 'git fetch' and 'git merge' from a Remote Tracking Branch (like 'git pull')

I have set up some remote tracking branches in git, but I never seem to be able to merge them into the local branch once I have updated them with 'git fetch'. For example, suppose I have remote branch called 'an-other-branch'. I set that up locally…
kaybenleroll
  • 16,794
  • 16
  • 54
  • 66
104
votes
10 answers

git refusing to fetch into current branch

I set up a remote repository and I can push new changes to it, but I cannot fetch from it, I always get the (rather cryptic) error message: fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository fatal: The remote end…
Olivier Verdier
  • 46,998
  • 29
  • 98
  • 90
96
votes
7 answers

git fetch origin --prune doesn't delete local branches?

At one point I thought that git fetch origin --prune deleted local branches that were no longer present on the server. Somehow this is not my experience at the moment. I ran this command, and the local branch was not deleted. It is not currently…
yano
  • 4,095
  • 3
  • 35
  • 68
77
votes
4 answers

Where to find changes due to `git fetch`

I didn't want to lose some information after a git pull, so I did a git fetch before. Where can I read the new modifications after a git fetch? I went to the FETCH_HEAD file, but there was nothing more than a big number.
epsilones
  • 11,279
  • 21
  • 61
  • 85
66
votes
3 answers

Fetch a single tag from remote repository

This command fetches all tags: git fetch origin --tags This command fetches a specific tag: git fetch origin refs/tags/1.0.0 But that doesn't let me do: git checkout tags/2.3.18 How can I fetch a single tag and then perform a checkout?
aleclarson
  • 18,087
  • 14
  • 64
  • 91
58
votes
4 answers

Git merge after fetch - how, exactly?

I've read from various sources that it's usually a better idea to fetch then merge rather than simply pull as it allows for finer control. That said, I've yet to find actually how to do it. Case in point: There was a small change made to some of…
Major Productions
  • 5,914
  • 13
  • 70
  • 149
58
votes
4 answers

Having a hard time understanding git-fetch

I am having a hard time understanding the nuances of git-fetch. I understand that doing a fetch, fetches the remote refs into a local tracking branch. I have a few questions though: Can it be possible that a local tracking branch does not exist? If…
Parag
  • 12,093
  • 16
  • 57
  • 75
53
votes
7 answers

GIT pull error - remote object is corrupted

$ git pull remote: fatal: object 21f3981dd35fccd28febabd96f27241eea856c50 is corrupted error: git upload-pack: git-pack-objects died with error. fatal: git upload-pack: aborting due to possible repository corruption on the remote side. remote:…
Senthil A Kumar
  • 10,306
  • 15
  • 44
  • 55
45
votes
2 answers

git pull analogous to / opposite of git push -f?

Sometimes, esp. when I'm the only one working on a remote repository, I like rewriting the history with git rebase -i and git push origin master -f. How do I do a forced git pull origin master without a merge? I tried it with the -f option, but that…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
45
votes
10 answers

Why is Jenkins failing when fetching from git, while the command line isn't?

All of my Jenkins builds are failing at the git fetch line. It's failing at git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git Started by user anonymous Building in workspace /Users/ethen/.jenkins/workspace/Build NikNik > git…
Eliza Wilson
  • 1,031
  • 1
  • 13
  • 38
1
2
3
26 27