Hub: pull-request error: not currently on any branch

Created on 5 Jul 2017  ·  17Comments  ·  Source: github/hub

My problem: I could not use pull-request at all, I kept getting this error

$ git pull-request -b <user>:master -h DancingQuanta:extra-syntaxes
Aborted: not currently on any branch.

I am on Cygwin with Windows executable hub.

more-info-needed

Most helpful comment

i am using a bash alias to get around this:
alias pr='hub pull-request --head=git rev-parse --symbolic-full-name HEAD'

All 17 comments

Does it help if you check out any branch in git? Or did you expect it to work while on detached HEAD (fancy git term for "not on any branch")?

I am not in detached HEAD though.

On Thursday, July 6, 2017, Mislav Marohnić notifications@github.com wrote:

Does it help if you check out any branch in git? Or did you expect it to
work while on detached HEAD (fancy git term for "not on any branch")?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/github/hub/issues/1503#issuecomment-313474196, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIB3VVNX0qzh4QGfHEIzENCaBxBjux2Bks5sLSHggaJpZM4OOkyb
.

--
Andy Tolmie

Oh, that's odd. Does the current branch show up if you do git rev-parse --symbolic-full-name HEAD? Which hub version are you using?

Here

19:48:40 andre@LAPTOP-V9S562AR:~/.vim/bundle/taskwiki
(extra-syntaxes)
$ git b
* extra-syntaxes
  master
19:48:42 andre@LAPTOP-V9S562AR:~/.vim/bundle/taskwiki
(extra-syntaxes)
$ git rev-parse --symbolic-full-name HEAD
refs/heads/extra-syntaxes
19:49:11 andre@LAPTOP-V9S562AR:~/.vim/bundle/taskwiki
(extra-syntaxes)
$

My prompt already tells me what branch I am on with a (<branch>) after current directory.

Here is part of the bash code that controls my prompt

# Activate git prompt
GITPROMPT="$HOME/.shell/source.d/git-prompt.sh"
if [ -f $GITPROMPT ]; then
  source $GITPROMPT
  PS1_GIT=${SH_YELLOW}'$(__git_ps1 "\n(%s)")'
else
  PS1_GIT=
fi

Oh I almost forgot, my hub version is

19:54:51 andre@LAPTOP-V9S562AR:~
$ git --version
git version 2.12.3
hub version 2.3.0-pre9

We had some Windows fixes since, so please try again with the newest hub version!

Closing since we haven't had reports of this since.

$ git rev-parse --symbolic-full-name HEAD
refs/heads/mybranch
$ hub version
git version 2.17.0
hub version 2.10.0
$ hub pull-request -m "add stuff" -r xyz,abc
Aborted: not currently on any branch.
$ uname -a
CYGWIN_NT-10.0 addis 3.0.4(0.338/5/3) 2019-03-16 09:50 x86_64 Cygwin

@pingmai Thank you; this might be related to the fact that you're on Windows but I'm not sure.

Can you tell me the output of cat `git rev-parse -q --git-dir`/HEAD?

[20541] ping@addis:~/git/prod-01-new-aws-account-creation (ping/update-developer-role=)$ cat git rev-parse -q --git-dir/HEAD
ref: refs/heads/ping/update-developer-role

@pingmai Thank you. I can't tell where the problem is since everything seems good on your end re: currently checked out branch. It looks like you're properly on ping/update-developer-role branch. I have no idea for now why hub would fail with “not currently on any branch” error.

If someone has time to debug on Windows/Cygwin, it would be much appreciated!

I cannot reproduce this with latest hub, Cygwin 3.0.7, and Windows 10.

I'm closing this due to lack of reproducible information. It might also be a problem with Cygwin runtime. Windows users who use hub outside of Cygwin have never reported such a problem.

Please reopen when you have more information about where the bug migth be!

[18208] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ hub pull-request -m "add cx-dvb node #85" -r srspndr,etherops
Aborted: not currently on any branch.
[18209] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ hub --version
git version 2.21.0
hub version 2.12.7
[18211] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ git status
On branch ping/INF-3066.add.dvb.#85
Your branch is up to date with 'origin/ping/INF-3066.add.dvb.#85'.

nothing to commit, working tree clean
[18212] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ uname -a
CYGWIN_NT-10.0 XPS8900 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin
[18213] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ git rev-parse --symbolic-full-name HEAD
refs/heads/ping/INF-3066.add.dvb.#85
[18214] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ 
[18212] ping@XPS8900:~/.../aws/us_east_1_production/lost (ping/INF-3066.add.dvb.#85=)$ uname -a
CYGWIN_NT-10.0 XPS8900 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin

@pingmai Thank you for the additional info. I tried to reproduce with the same branch name ping/INF-3066.add.dvb.#85, thinking it might be because of the # in branch name, but I couldn't reproduce. hub pull-request worked on this branch for me.

To work around your issue for now, pass the --head argument explicitly:

hub pull-request --head='ping/INF-3066.add.dvb.#85' ...

yup it worked with --head.
it might be related to the length of the directory.

i am using a bash alias to get around this:
alias pr='hub pull-request --head=git rev-parse --symbolic-full-name HEAD'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cbeams picture cbeams  ·  4Comments

kurko picture kurko  ·  4Comments

xxmyjk picture xxmyjk  ·  4Comments

technosophos picture technosophos  ·  3Comments

aryan9600 picture aryan9600  ·  3Comments