Bug 387226 - Cannot switch to remote git branch
Summary: Cannot switch to remote git branch
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: file tree (show other bugs)
Version: 5.2.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-22 21:04 UTC by Piotr Mierzwinski
Modified: 2017-11-23 13:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2017-11-22 21:04:53 UTC
I created new branch in terminal and pushed it.
I run KDevelop and wanted switch (from master) to this new branch, so I invoked "Git pull" and in Branches option I received newly created branch. After that I called "Checkout". Unfortunately in "Project" view I saw "my_project (no branch)" and in "Version Control" view:
/path/to/my/project> git checkout remotes/origin/main_menu

Checking in terminal the name of branch I see string of some numbers, KDevelop is not able to recognize it as correct name of branch.

OK. I hoped that when I run one more time git -> Pull option the I will be able download the changes, but unfortunately I received following messages:
<cut>
/path/to/my/project> git pull
Command exited with value 1.
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>


Command finished with error UnknownError.
</cut>

I'm not sure if KDevelop does this operation well, because when I run from terminal commands present below, I'm able to receive correct branch name and all made changes.

$ git checkout -b main_menu origin/main_menu
Branch 'main_menu' set up to track remote branch 'main_menu' from 'origin'.
Switched to a new branch 'main_menu'

$ git pull origin main_menu 
From bitbucket.org:qtcmd/qtcmd2
 * branch            main_menu  -> FETCH_HEAD
Already up to date.
Comment 1 Sven Brauch 2017-11-23 13:03:36 UTC
Yes, what KDevelop does here is wrong. You cannot switch to a remote branch with "git checkout remotes/origin/foo" because you simply cannot switch to remote branches.