Can a git repository be corrupted if a command modifying it crashes or is aborted?

前端 未结 1 1661
天涯浪人
天涯浪人 2020-12-16 16:07

When playing around with git, I sometimes try out things, then abort commands which take too long (e.g. some git svn commands that hang during netw

相关标签:
1条回答
  • 2020-12-16 16:59

    The repository is fully transactional, yes.

    The work tree is almost transactional, but there is a corner case that can't easily be dealt with. Checkout does all necessary checks and writes the new content to temporary files and during the time, nothing is modified if you interrupt it. But then it's renaming the files to the tree one by one and finally updates the HEAD ref and interrupting in that phase can leave you with partial changes made to the tree. There is no mass-rename to allow doing that atomically.

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