New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Head branch #10138
Head branch #10138
Conversation
I think this should be more robust since it doesn't rely on a fixed list of potential names.
fi | ||
done | ||
echo master | ||
git branch -rl "*/HEAD" | rev | cut -d/ -f1 | rev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
should also work if you prefer to use sed
instead of rev
and cut
but all of these are pretty standard tools that should be available in any system running git
on zsh
....
See #9879 (comment):
|
I don't understand how making the function simpler and more generic is worse than covering a specific use case using more complexity. |
See #9114 on why this doesn't work.
|
yeah I would understand that if I was adding complexity or some extra specific use case but I'm making the function more generic and reducing the complexity, if the problem is the use of Why only support the specific case of choosing between |
also, in the current implementation if both |
Please read #9114 again. The remote HEAD was set to develop, so the solution failed to work. Making it more generic makes it worse. You also fail to account for remote-less repositories (go try it on a folder that you just |
By design. |
I think this should be more robust since it doesn't rely on a fixed list of potential names.
Standards checklist:
Changes:
git branch -rl "*/HEAD" | rev | cut -d/ -f1 | rev
to get themain
branch instead of trying to guess it.