Removing code from GitHub

前端 未结 4 1268
抹茶落季
抹茶落季 2020-12-25 11:23

Is there a way to entirely remove a directory and its history from GitHub?

4条回答
  •  难免孤独
    2020-12-25 12:01

    To selectively delete a file or directory (and all its associated history), you can use git filter-branch.

    This is very useful when you want to completely delete files checked into the repository by mistake.

    The syntax is simple:

    git filter-branch --tree-filter 'rm -f filename' HEAD
    

    More info on the man page.

提交回复
热议问题