How can I archive git branches?

后端 未结 11 2207
無奈伤痛
無奈伤痛 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:24

    I sometimes archive branches as follows:

    1. Generate patch files, e.g., format-patch ^.. (get firstHash and lastHash using git log .
    2. Move the generated patch files to directory on a file server.
    3. Delete the branch, e.g., git branch -D

    "Apply" the patch when you need to use the branch again; however, applying the patch files (see git am) can be challenging depending on the state of the target branch. On the plus side, this approach has the benefit of allowing the branch's commits to be garbage-collected and saving space in your repo.

提交回复
热议问题