git-fetch

“fetch --all” in a git bare repository doesn't synchronize local branches to the remote ones

烈酒焚心 提交于 2019-11-27 04:26:37
I'm trying to synchronize periodically a git bare repository, my local branches are created using the "--track" option. here is my config (without unnecessary things): [core] bare = true [remote "origin"] url = git@github.com:Ummon/D-LAN.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [branch "website"] remote = origin merge = refs/heads/website I must use the 'cp' command to update the local branches: git fetch --all cp -r refs/remotes/origin/* refs/heads Is there a more elegant solution? sehe Instead of copying the ref files around

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

£可爱£侵袭症+ 提交于 2019-11-27 02:29:41
问题 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"] remote = origin merge = refs/heads/master What is the meaning and purpose of the contents of these sections, in particular the fetch and merge subsections? How is this information used by Git to guide its operation? 回答1: Its called refspec. Its the mechmism that

Pulling just one directory out of a git repo

不羁的心 提交于 2019-11-27 01:57:16
问题 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 files / #Except the one I want !/temp The problem is this doesn't work. Is that the right way to do it or is there a better way? 回答1: git pull fetches and merges the remote branch. .gitignore works only locally, and will hide matching entries from

git fetch, FETCH_HEAD and origin/master

若如初见. 提交于 2019-11-27 01:29:12
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 something. However, origin/master ended up still pointing to the same old commit (actually it's under the name dev but I'll call it master - he doesn't have a master ). After that I tried git fetch origin master but it didn't seem to do anything, it only updated FETCH_HEAD . I tagged the FETCH_HEAD commit so I wouldn't lose it, but I'd still like to have

git refusing to fetch into current branch

不羁的心 提交于 2019-11-27 01:26:34
问题 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 hung up unexpectedly What does it mean? What should I do to enable fetching? (Note that this remote repo is only used as a backup repo, so it should be pretty much an exact copy of my local repository. I really can't understand why I can push to it

Git fetch remote branch

*爱你&永不变心* 提交于 2019-11-26 21:11:56
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 the branch . My question is, how can my colleague pull that branch specifically? A git clone of the repo does not seem to create the branches locally for him, though I can see them live on unfuddle after a push on my end. Also, when I originally made the branch I did -b checkout . Not sure if that makes much difference? $ git branch -r origin/HEAD ->

Git pull/fetch with refspec differences

岁酱吖の 提交于 2019-11-26 20:28:29
问题 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 do the merge with current branch I would expect different behavior from: git fetch origin master:mymaster and from git pull origin master:mymaster Both of the above commands seem to produce exactly same result - that is a local branch called

How do you git fetch then merge? “Error: Your local changes to the following files would be overwritten by merge”

痞子三分冷 提交于 2019-11-26 19:44:25
问题 Newbie Git question: I have a repo set up on bitbucket. I git fetched someone else's changes and would like to merge them with my own. However, when I try to git merge (or git merge origin/master), I get the message "error: Your local changes to the following files would be overwritten by merge:", and then a list of files I've changed. Having Git merge these changes is exactly what I want to do though. 回答1: You can either commit your changes before you do the merge, or you stash them: git

GIT pull error - remote object is corrupted

大兔子大兔子 提交于 2019-11-26 15:44:46
问题 $ 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: aborting due to possible repository corruption on the remote side. fatal: protocol error: bad pack header Any ideas why this is failing? When I run git --bare fsck-objects --full I just see dangling links but no broken links. Also git gc didn't help in

Differences between git remote update and fetch?

流过昼夜 提交于 2019-11-26 12:53:09
问题 Is git remote update the equivalent of git fetch ? 回答1: UPDATE: more information! I should have done this from the start: I grepped the Git release notes in Git's Git repo (so meta!) grep --color=always -R -C30 fetch Documentation/RelNotes/* | less Then I did a less search for --all , and this is what I found under the release notes for Git version 1.6.6: git fetch learned --all and --multiple options, to run fetch from many repositories, and --prune option to remove remote tracking branches