Tab completion for git branches showing old/outdated entries

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm on a sort of frankendebian stretch/sid (not the best idea, I know; planning on reinstalling soon).



Tab completion works for git branch names in git repo directories:



:~/project $ git checkout <TAB><TAB>
Display all 200 possibilities? (y or n)

:~/project $ git checkout private-rl_<TAB><TAB>
private-rl_1219_misspelled_locale_zhtw private-rl_1950_scheduler_offset private-rl_bootstrap_rake_tasks
private-rl_1854_ldap_filter_reset private-rl_bootstrap_rake_task


But some of the branches it shows don't exist anymore:



:~/project $ git branch
* develop
private-rl_1219_misspelled_locale_zhtw
stable


This also happens for deleted remote branches.



What's going on here? Does the git completion script keep a cache of old branches that can be flushed somehow? How can I stop these branches from accumulating in my tab-completion results?







share|improve this question



















  • Are you sure they are not tags? Autocompletion takes into account tags, and many other things. See top comments on github.com/git/git/blob/master/contrib/completion/…
    – Patrick Mevzek
    May 3 at 13:24










  • I'm 100% sure they're not tags. I created and deleted those branches myself. Weird though — I just did $ sudo fd --hidden --no-ignore git-completion /, and didn't get any results.
    – Ryan Lue
    May 3 at 14:04










  • Do git branch -a to see all branches. Remote branches may be taken into account also.
    – Patrick Mevzek
    May 3 at 14:09










  • Thanks, it was references to deleted remotes (see answer below).
    – Ryan Lue
    May 3 at 14:30














up vote
0
down vote

favorite












I'm on a sort of frankendebian stretch/sid (not the best idea, I know; planning on reinstalling soon).



Tab completion works for git branch names in git repo directories:



:~/project $ git checkout <TAB><TAB>
Display all 200 possibilities? (y or n)

:~/project $ git checkout private-rl_<TAB><TAB>
private-rl_1219_misspelled_locale_zhtw private-rl_1950_scheduler_offset private-rl_bootstrap_rake_tasks
private-rl_1854_ldap_filter_reset private-rl_bootstrap_rake_task


But some of the branches it shows don't exist anymore:



:~/project $ git branch
* develop
private-rl_1219_misspelled_locale_zhtw
stable


This also happens for deleted remote branches.



What's going on here? Does the git completion script keep a cache of old branches that can be flushed somehow? How can I stop these branches from accumulating in my tab-completion results?







share|improve this question



















  • Are you sure they are not tags? Autocompletion takes into account tags, and many other things. See top comments on github.com/git/git/blob/master/contrib/completion/…
    – Patrick Mevzek
    May 3 at 13:24










  • I'm 100% sure they're not tags. I created and deleted those branches myself. Weird though — I just did $ sudo fd --hidden --no-ignore git-completion /, and didn't get any results.
    – Ryan Lue
    May 3 at 14:04










  • Do git branch -a to see all branches. Remote branches may be taken into account also.
    – Patrick Mevzek
    May 3 at 14:09










  • Thanks, it was references to deleted remotes (see answer below).
    – Ryan Lue
    May 3 at 14:30












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm on a sort of frankendebian stretch/sid (not the best idea, I know; planning on reinstalling soon).



Tab completion works for git branch names in git repo directories:



:~/project $ git checkout <TAB><TAB>
Display all 200 possibilities? (y or n)

:~/project $ git checkout private-rl_<TAB><TAB>
private-rl_1219_misspelled_locale_zhtw private-rl_1950_scheduler_offset private-rl_bootstrap_rake_tasks
private-rl_1854_ldap_filter_reset private-rl_bootstrap_rake_task


But some of the branches it shows don't exist anymore:



:~/project $ git branch
* develop
private-rl_1219_misspelled_locale_zhtw
stable


This also happens for deleted remote branches.



What's going on here? Does the git completion script keep a cache of old branches that can be flushed somehow? How can I stop these branches from accumulating in my tab-completion results?







share|improve this question











I'm on a sort of frankendebian stretch/sid (not the best idea, I know; planning on reinstalling soon).



Tab completion works for git branch names in git repo directories:



:~/project $ git checkout <TAB><TAB>
Display all 200 possibilities? (y or n)

:~/project $ git checkout private-rl_<TAB><TAB>
private-rl_1219_misspelled_locale_zhtw private-rl_1950_scheduler_offset private-rl_bootstrap_rake_tasks
private-rl_1854_ldap_filter_reset private-rl_bootstrap_rake_task


But some of the branches it shows don't exist anymore:



:~/project $ git branch
* develop
private-rl_1219_misspelled_locale_zhtw
stable


This also happens for deleted remote branches.



What's going on here? Does the git completion script keep a cache of old branches that can be flushed somehow? How can I stop these branches from accumulating in my tab-completion results?









share|improve this question










share|improve this question




share|improve this question









asked May 3 at 3:28









Ryan Lue

1947




1947











  • Are you sure they are not tags? Autocompletion takes into account tags, and many other things. See top comments on github.com/git/git/blob/master/contrib/completion/…
    – Patrick Mevzek
    May 3 at 13:24










  • I'm 100% sure they're not tags. I created and deleted those branches myself. Weird though — I just did $ sudo fd --hidden --no-ignore git-completion /, and didn't get any results.
    – Ryan Lue
    May 3 at 14:04










  • Do git branch -a to see all branches. Remote branches may be taken into account also.
    – Patrick Mevzek
    May 3 at 14:09










  • Thanks, it was references to deleted remotes (see answer below).
    – Ryan Lue
    May 3 at 14:30
















  • Are you sure they are not tags? Autocompletion takes into account tags, and many other things. See top comments on github.com/git/git/blob/master/contrib/completion/…
    – Patrick Mevzek
    May 3 at 13:24










  • I'm 100% sure they're not tags. I created and deleted those branches myself. Weird though — I just did $ sudo fd --hidden --no-ignore git-completion /, and didn't get any results.
    – Ryan Lue
    May 3 at 14:04










  • Do git branch -a to see all branches. Remote branches may be taken into account also.
    – Patrick Mevzek
    May 3 at 14:09










  • Thanks, it was references to deleted remotes (see answer below).
    – Ryan Lue
    May 3 at 14:30















Are you sure they are not tags? Autocompletion takes into account tags, and many other things. See top comments on github.com/git/git/blob/master/contrib/completion/…
– Patrick Mevzek
May 3 at 13:24




Are you sure they are not tags? Autocompletion takes into account tags, and many other things. See top comments on github.com/git/git/blob/master/contrib/completion/…
– Patrick Mevzek
May 3 at 13:24












I'm 100% sure they're not tags. I created and deleted those branches myself. Weird though — I just did $ sudo fd --hidden --no-ignore git-completion /, and didn't get any results.
– Ryan Lue
May 3 at 14:04




I'm 100% sure they're not tags. I created and deleted those branches myself. Weird though — I just did $ sudo fd --hidden --no-ignore git-completion /, and didn't get any results.
– Ryan Lue
May 3 at 14:04












Do git branch -a to see all branches. Remote branches may be taken into account also.
– Patrick Mevzek
May 3 at 14:09




Do git branch -a to see all branches. Remote branches may be taken into account also.
– Patrick Mevzek
May 3 at 14:09












Thanks, it was references to deleted remotes (see answer below).
– Ryan Lue
May 3 at 14:30




Thanks, it was references to deleted remotes (see answer below).
– Ryan Lue
May 3 at 14:30










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










I figured it out, thanks to some gentle prodding from @PatrickMevzek:



The branches I was seeing were actually references to remote branches that had already been deleted. To quote the top answer from the SO thread linked above,



$ git remote prune origin


fixed it for me.






share|improve this answer




























    up vote
    -1
    down vote













    git(1) comes with contributed files in git/contrib/completion/ in the source. The script for your shell handles completions.






    share|improve this answer





















    • I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
      – Ryan Lue
      May 3 at 14:07










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441442%2ftab-completion-for-git-branches-showing-old-outdated-entries%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    I figured it out, thanks to some gentle prodding from @PatrickMevzek:



    The branches I was seeing were actually references to remote branches that had already been deleted. To quote the top answer from the SO thread linked above,



    $ git remote prune origin


    fixed it for me.






    share|improve this answer

























      up vote
      2
      down vote



      accepted










      I figured it out, thanks to some gentle prodding from @PatrickMevzek:



      The branches I was seeing were actually references to remote branches that had already been deleted. To quote the top answer from the SO thread linked above,



      $ git remote prune origin


      fixed it for me.






      share|improve this answer























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        I figured it out, thanks to some gentle prodding from @PatrickMevzek:



        The branches I was seeing were actually references to remote branches that had already been deleted. To quote the top answer from the SO thread linked above,



        $ git remote prune origin


        fixed it for me.






        share|improve this answer













        I figured it out, thanks to some gentle prodding from @PatrickMevzek:



        The branches I was seeing were actually references to remote branches that had already been deleted. To quote the top answer from the SO thread linked above,



        $ git remote prune origin


        fixed it for me.







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered May 3 at 14:29









        Ryan Lue

        1947




        1947






















            up vote
            -1
            down vote













            git(1) comes with contributed files in git/contrib/completion/ in the source. The script for your shell handles completions.






            share|improve this answer





















            • I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
              – Ryan Lue
              May 3 at 14:07














            up vote
            -1
            down vote













            git(1) comes with contributed files in git/contrib/completion/ in the source. The script for your shell handles completions.






            share|improve this answer





















            • I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
              – Ryan Lue
              May 3 at 14:07












            up vote
            -1
            down vote










            up vote
            -1
            down vote









            git(1) comes with contributed files in git/contrib/completion/ in the source. The script for your shell handles completions.






            share|improve this answer













            git(1) comes with contributed files in git/contrib/completion/ in the source. The script for your shell handles completions.







            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered May 3 at 11:32









            vonbrand

            13.9k22443




            13.9k22443











            • I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
              – Ryan Lue
              May 3 at 14:07
















            • I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
              – Ryan Lue
              May 3 at 14:07















            I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
            – Ryan Lue
            May 3 at 14:07




            I appreciate the sentiment, but the script as linked by @PatrickMevzek above is already over 3,000 lines long. If I had all day to read through git-completion.bash, well, I'd probably take my dogs for a hike instead anyway.
            – Ryan Lue
            May 3 at 14:07












             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441442%2ftab-completion-for-git-branches-showing-old-outdated-entries%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay