24

git pushや並行して実行することが安全かどうかに興味がありますgit commit(たとえば、cron ジョブ、jenkins ジョブなど)。これらの操作がシリアル化されているか、リポジトリが破損する可能性があるため、git に組み込みのロック メカニズムがありますか?

4

2 に答える 2

19

Yes. Git works by writing references in a manner that allows for this. If you are doing a commit at the same time as a push, push will only go from the references down to the objects they contain. If the commit finishes and updates the branch reference on time, it will get pushed. If it doesn't, the old reference will be pushed. You won't get "half a commit" pushed up.

All files are written in a manner that implicitly preserves referential integrity for any pointers. The last file written will be the reference that already has all it's dependencies there.

于 2012-11-19T17:46:14.227 に答える