So a git diff done in your working tree would show differences between your files and D, not your previous HEAD B. then your current index would reflect D, and no longer B. That forced update might be what you want if your current branch is not develop.īut if you are on develop when you type git fetch origin develop:develop, and if the fetch was allowed to update HEAD. + bbbbbbb.ddddddd develop -> origin/develop (forced update) Suppose that I run git fetch and it brings in two new commits that I will label C and D.Ĭ's parent is A, and D's is the node just before B: C See " git pull with refspec" as an example. The index as if you're removing everything. It would also fail to update the working directory and would leave I think " git fetch url side:master" when master is the current branchĪnd we have omitted -update-head-ok is broken. That is the fetch part: it stores the remote history from the updated origin/master.īut that is especially broken when the current local branch is also master. While it might make sense to store what you want to pull Regarding the origin of this patch, follow the discussion there. This is purely for the internal use for git pull to communicate with git fetch, and unless you are implementing your own Porcelain you are not supposed to use it.Įven though you are not supposed to use that option, it does answer your initial requirement, making “ git fetch origin branch:branch” work on a current branch. uīy default git fetch refuses to update the head which corresponds to the current branch. That means a git fetch -u origin develop:develop should work. Repositories, which is an improvement from the original behaviour.Ĭonsidering that the function check_not_current_branch() is called with: if (!update_head_ok) The check for the current branch is now only performed in non-bare This should only be allowed when (an incorrect) " git pull origin master:master" tries to work around by giving -update-head-ok to underlying " git fetch", and otherwise we should refuse it, but somewhere along the lines we lost that behavior. Plain wrong when the current branch is " master". While it might make sense to store what you want to pull, it typically is (or even worse: the same command line with "pull" instead of "fetch"). Into the current branch with something like this: git fetch origin master:master Some confusing tutorials suggested that it would be a good idea to fetch (see also " Git refusing to fetch into current branch"). That function goes all the way back to commit 8ee5d73, Oct. The error message comes from builtin/fetch.c#check_not_current_branch().
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |