jacogr / atom-git-control

Not maintained :(
MIT License
227 stars 70 forks source link

Checkout of remote branch does not work correctly #110

Open mirrom opened 9 years ago

mirrom commented 9 years ago

For me the checkout of a remote branch does not work as intended. As you can see on the screenshot my remote branches are shown with a leading origin/:

git-remote

If I click on a remote branch it gets checked out with the leading origin/ as you can see with the local branches origin/master and origin/features/T170-split-files. Actually it checks out a new branch based on the current working branch:

> git checkout -b origin/features/T170-split-files
Switched to a new branch 'origin/features/T170-split-files'

I checked out the local branches master, develop and features/T170-split-files from the command line by:

$ git checkout features/T170-split-files
Branch features/T170-split-files set up to track remote branch features/T170-split-files from origin.
Switched to a new branch 'features/T170-split-files'

The local branches features/T170-split-files and origin/features/T170-split-files clearly differ as the latter is based on the master branch. Furthermore if I would push the latter branch with the suggested $ git push --set-upstream origin origin/features/T170-split-files, it would create the remote branch origin/origin/features/T170-split-files which I could checkout as local branch origin/origin/features/T170-split-files and so on and so on..

Is there a way that git-remote can handle the leading origin/?

mirrom commented 9 years ago

I guess my ticket is closely related to #109.

brylie commented 8 years ago

The --track, or -t, flag was the recommended solution as per the following sources:

As a convenience, --track without -b implies branch creation

If no -b option is given, the name of the new branch will be derived from the remote-tracking branch https://git-scm.com/docs/git-checkout

So, the basic command for checking out a remote branch and setting up tracking seems to be:

git checkout --track remote/branch