How can I archive git branches?

后端 未结 11 2241
無奈伤痛
無奈伤痛 2020-11-27 09:00

I have some old branches in my git repository that are no longer under active development. I would like to archive the branches so that they don\'t show up by default when r

11条回答
  •  甜味超标
    2020-11-27 09:23

    Here is an alias for that:

    arc    = "! f() { git tag archive/$1 $1 && git branch -D $1;}; f"
    

    Add it like this:

    git config --global alias.arc '! f() { git tag archive/$1 $1 && git branch -D $1;}; f'
    

    Bear in mind there is git archive command already so you cannot use archive as an alias name.

    Also you can define alias to view the list of the 'archived' branches:

    arcl   = "! f() { git tag | grep '^archive/';}; f"
    

    about adding aliases

提交回复
热议问题