When to delete branches in Git?

前端 未结 8 2028
走了就别回头了
走了就别回头了 2021-01-29 17:36

Suppose we have an application that\'s stable.

Tomorrow, someone reports a big ol\' bug that we decide to hotfix right away. So we create a branch for that hotfix off o

8条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 18:06

    What you need to do is tag anything that you release. Keep branches around for when you are actively developing.

    Delete old branches with

    git branch -d branch_name
    

    Delete them from the server with

    git push origin --delete branch_name
    

    or the old syntax

    git push origin :branch_name
    

    which reads as "push nothing into branch_name at origin".

    That said, as long as the DAG (directed acyclic graph) can point to it, the commits will be there in history.

    Google "git-flow" and that may give some more insight on release management, branching and tagging.

提交回复
热议问题