How to compute the git hash-object of a directory?

前端 未结 7 1116
既然无缘
既然无缘 2020-12-09 16:28

Does anyone have an example of using git hash-object on a directory? It works easily enough on a file* but doesn\'t work as I\'d expect for a directory**

*:         


        
相关标签:
7条回答
  • 2020-12-09 17:08

    After long searching I found the following command:

    git write-tree

    Source: http://git-scm.com/docs/git-write-tree

    I used it to recover the missing directory:

    git write-tree path/to/missing/folder

    And my missing tree object got created. From here you can continue using:

    git hash-object -w path/to/missing/folder/file.txt

    As explained in: https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F

    0 讨论(0)
提交回复
热议问题