![]() Git sees that there is no _memcache yet, checks through all your remotes, finds the single matching origin/_memcache, and does the quoted thing. Suppose you have only one remote, and you enter the command: git checkout _memcache If is not found but there does exist a tracking branch in exactly one remote (call it ) with a matching name, treat as equivalent to $ git checkout -b -track / The basic problem boils down to this one sentence in the git checkout documentation: Why it doesn't work: the shortcut has too many alternatives What have I done here to change this default behavior? This is the behavior I'm used to from all my workplaces and at home. $ git rev-parse -abbrev-ref -symbolic-full-name by default, when I clone a remote repo, checking out a branch on the remote creates a local branch of the same name, and sets it up to track the remote. I'm using git version 2.12.0.windows.1 on git-bash on windows 7.ĮDIT I did a regular clone, without changing the remotes, to test what I feel is expected behavior $ git clone into 'mysite'. How do I get my git repo to automatically branch and track the remote when I check out a remote branch? That's what does happen, before I change the remotes. Of course, I can create a new local branch matching the name of the remote branch, and set it to track the remote branch, but I'm used to that happening automatically. * (HEAD detached at origin/_social-media-footer) If you want to create a new branch to retain commits you create, you mayĭo so (now or later) by using -b with the checkout command again. State without impacting any branches by performing another checkout. ![]() You can look around, make experimentalĬhanges and commit them, and you can discard any commits you make in this ![]() Note: checking out 'origin/_social-media-footer'. Instead, I'm in a headless state: $ git checkout origin/_social-media-footer However, when I checkout a branch from either remote, the default behavior is no longer to create a new local branch of the same name that is tracking the remote. Then, because I will eventually want to push my development branches to the common remote repo, I added back the original origin, this time calling it acquia: git remote add acquia now my remotes look like this: $ git remote -vv (This remote already has my development branches). Then I made a new remote called origin based on a bare repo on our internal shared drive: git remote add origin file:///h/path-to-repo. When I clone the repo, the origin is set as the remote host, When I do git checkout, the new local branch is automatically tracking the remoteīecause I don't want to put a bunch of development branches on the remote repo, I removed the origin with git remote rm origin. The remote host is fairly limited I can't make a fork of the repo.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |