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
14
votes
1 answer

How can I tell Git to ignore certain branches when fetching/pulling?

Currently, when I pull, I get changes from all the branches: $ git pull remote: ... Unpacking objects: ... From ssh://github.com/... a69d94d..a2019da master -> origin/master b684d4a..b8819dc develop -> origin/develop +…
Jace Browning
  • 11,699
  • 10
  • 66
  • 90
14
votes
4 answers

git fetch, FETCH_HEAD and origin/master

I'm very new to git and I'm having trouble with a simple fetch operation. I'm trying to fetch a coworker's progress from his repository. At first I did git fetch HEAD which prompted git to download about 350MB of data so I was sure it had done…
DanielF
  • 161
  • 1
  • 2
  • 5
14
votes
1 answer

Pulling just one directory out of a git repo

I have a git repo that I want to do a pull from. I do a normal git pull with no problems. The issue is that I want just one certain directory out of the repo. My thinking was that I could use a .gitignore file with a rule like this: #Ignore all…
Dan
  • 1,222
  • 2
  • 17
  • 33
13
votes
3 answers

Git: Connect existing local repository to existing remote repository

This is probably pretty basic, but I wasn't able to figure it out yet: I have a PHP project running on two servers, let's refer to those as Live and Staging Both servers are running the same project obviously but with some changes. The project was…
Chaz
  • 672
  • 1
  • 5
  • 19
13
votes
2 answers

How do I clone, fetch or sparse checkout a single directory or a list of directories from git repository?

How do I clone, fetch or sparse checkout a single file or directory or a list of files or directories from a git repository avoiding downloading the entire history or at least keeping history download at minimum? For the benefit of people landing…
13
votes
4 answers

Skip copying some branches/tags to local Git with `git fetch --all`

I have many remotes added to my Git. Each remote is a repository for one developer. Every day I fetch --all to see any new branches they create that are ready to review. However, developers can push "private" branches to the remote. Say, all…
palazzo train
  • 3,229
  • 1
  • 19
  • 40
12
votes
3 answers

git fetch branches with specified prefix

I have following branches in remote origin. ft_d_feature_abc ft_d_feature_xyz ft_d_feature_lam ft_d_feature_ton ft_m_feature_mak ft_m_feature_echo ft_m_feature_laa ft_m_feature_pol I want to fetch branches which are starting with ft_d. How can I…
dnsh
  • 3,516
  • 2
  • 22
  • 47
12
votes
2 answers

git fetch origin doesn't fetch all branches

I read in the answers to this question that git fetch origin should fetch all branches of origin. In my case, it doesn't seem to give me any branches, though. Here's what I did: Initially, a remote called origin had 7 branches. I cloned it. git…
Cerran
  • 2,087
  • 2
  • 21
  • 33
12
votes
1 answer

Issue with git pull master is out of sync with origin master

These are the sequence of steps I have performed: committed my changes in branch to local master (commit id dc9afg2k) git fetch origin master && git merge origin master git checkout master git pull (this pulled all recent changes) git fetch origin…
user1769790
  • 1,183
  • 3
  • 11
  • 23
12
votes
1 answer

What would be the opposite of "git fetch"?

If I do git fetch from repo A to B, the master branch in B doesn't change - changes only remotes/origin/master, and git status reminds me of it. But now I want to do the opposite - update B from A, something like pushing from A:master to…
Rogach
  • 26,050
  • 21
  • 93
  • 172
11
votes
2 answers

Why is git fetch not fetching any tags?

I have created a sandbox git repository containing a few commits and a couple of tags, one lightweight and one annotated: > mkdir one; cd one; git init > touch a.txt; git add a.txt; git commit -m"a.txt" > touch b.txt; git add b.txt; git commit…
user200783
  • 13,722
  • 12
  • 69
  • 135
11
votes
9 answers

Git Fetch returns 'fatal: I don't handle protocol https' in windows

Just after adding remote repo, I tried git fetch remoteRepoName but it's returning this error: fatal: I don't handle protocol 'https' I explored relevant questions but most of these belongs to git clone so their answers aren't working in my case.…
Adil
  • 21,278
  • 7
  • 27
  • 54
11
votes
4 answers

Why does git fetch via hudson fail, while git fetch via the command line works?

I'm trying to fetch a read-only git repository from github and have it be built via hudson. This process is failing. This is the hudson output: Started by an SCM change Checkout:workspace / d:\hudson\home\jobs\gdcm-hudson\workspace -…
mmr
  • 14,781
  • 29
  • 95
  • 145
11
votes
1 answer

git fetch insufficient permission for adding an object to repository database .git/objects?

In my repo in my home directory (on an Ubuntu box) I did git fetch I unfortunately got an error about: insufficient permission for adding an object to repository database .git/objects There's a gazillion directories in .git/objects and all of…
10
votes
3 answers

Git gc and git prune warnings when git fetch origin is run

Working with remote repository at some moment I started recieving this when I run git fetch origin Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping. warning: The last gc run reported…
Dmitriy Metelya
  • 109
  • 1
  • 1
  • 4