git-fetch

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

走远了吗. 提交于 2019-11-27 23:53:25
问题 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 answer to one of the questions comes closest, but doesn't go into detail. I'll just quote it verbatim: If you get this message after doing a "git pull remote branch", try following it up with a "git fetch". Fetch seems to update the local representation

Git pull/fetch with refspec differences

守給你的承諾、 提交于 2019-11-27 20:40:48
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 mymaster, same as origin/master. Am I right or is there a vague difference between the two? Finally, using a

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

你。 提交于 2019-11-27 19:05:19
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. You can either commit your changes before you do the merge, or you stash them: git stash git merge origin/master git stash pop If you want to keep your changes, you can commit your changes to

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

人走茶凉 提交于 2019-11-27 16:49:06
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 remote pointing to my Github page: [root@osboxes c]# git remote add learnc https://github.com/michaelklachko/Learning-C That seemed to be successful: [root@osboxes c]# git remote show learnc * remote learnc Fetch URL: https://github.com/michaelklachko/Learning-C Push URL: https://github.com/michaelklachko/Learning-C HEAD branch: master Remote branch:

GIT pull error - remote object is corrupted

帅比萌擦擦* 提交于 2019-11-27 11:46:17
$ 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 any way. When I reclone or do pull from another clone, I don't see this error. As Julian said see https

Differences between git remote update and fetch?

不羁岁月 提交于 2019-11-27 06:08:58
Is git remote update the equivalent of git fetch ? 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 that went stale. These make git remote update and git remote prune less necessary (there is no plan to

How to update a git clone --mirror?

﹥>﹥吖頭↗ 提交于 2019-11-27 05:49:36
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 commands I must use? I'd like to keep everything updated: commits, refs, hooks, branches, etc. Thanks! This is the command that you need to execute on the mirror: git remote update J. Bruni Regarding commits, refs, branches and " et cetera ", Magnus answer just works ( git remote update ). But unfortunately there is no way to clone / mirror / update the

Is it possible to pull just one file in Git?

白昼怎懂夜的黑 提交于 2019-11-27 05:49:30
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 attempt to merge lots of other files, for that I am not yet ready. Is it possible to pull and merge only the specified file (and not everything) from that another branch? This is not a duplicate of Git pull request for just one file as all answers to that question are how to revert the locally changed file to the repository version, without changing any

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

给你一囗甜甜゛ 提交于 2019-11-27 05:38:43
问题 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 checked out. I ran git branch -vv to check this info, and I see feature/MyGreatFeature f30efc7 [origin/feature/MyGreatFeature: gone] So it seems to know that it is gone. Why would it not delete my local branch? Running git version 2.7.4 (Apple Git-66)

fetch from origin with deleted remote branches?

坚强是说给别人听的谎言 提交于 2019-11-27 04:55:41
问题 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? 回答1: You need to do the following git fetch -p This will update the local database of remote branches. 回答2: From http://www.gitguys.com/topics/adding-and-removing-remote-branches/ After someone deletes a branch from a remote repository, git will not automatically delete the local repository branches when a