Correction to git script to create a work branch
Ahmad Samir
a.samirh78 at gmail.com
Sun Oct 31 21:49:30 GMT 2021
This concerns this section:
https://community.kde.org/Infrastructure/GitLab#Using_work_branches_instead_of_forks
The first version of the script (written by me) had a stupid flaw, it didn't guard against being
called with an empty arg; usually it should be used like this:
$ git work branch-name
if you end up using it without an arg, just `git work`, the setup of your git repo could get screwed
up, for example, trying to create a branch afterwards, you could end up with:
warning: refname 'origin/master' is ambiguous.
warning: refname 'origin/master' is ambiguous.
fatal: Ambiguous object name: 'origin/master'.
Fortunately, the fix seems to be simple:
$ git show-ref master
a6b947711efdf83718ad4d5ffb384a2bd36e559d refs/heads/master
3ae9d7d897d248024d5bc060fe89f7c30154d4c6 refs/heads/origin/master
a6b947711efdf83718ad4d5ffb384a2bd36e559d refs/remotes/origin/master
$ git update-ref -d refs/heads/origin/master
see this excellent https://stackoverflow.com/a/26046933 post for explanation (I am not a git expert,
but that worked, AFAICS).
Anyway, the script has been fixed to bail out early if it's called without an arg.
Sorry for the inconvenience. :)
--
Ahmad Samir
More information about the Kde-frameworks-devel
mailing list