I am interested if it is safe to run things like git push
and git commit
in parallel (for example in cron jobs, jenkins jobs etc.). Is there some locking mechanism built-in in git so these operations are serialized or this can corrupt the repository?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- What is the best way to create a lock from a web a
- What is the tortoisehg gui equivalent of doing “hg
- How to use Mercurial from Visual Studio 2010?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is it possible to do a “destroy history” in TFS?
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.
In theory, there could be a rare case of race condition for the
git commit
part, where theHEAD
file is not available.That was silent before Git 2.15.x/2.16 (Q1 2018). It won't be silent anymore.
See commit c26de08 (20 Oct 2017) by Andrey Okoshkin (``).
(Merged by Junio C Hamano --
gitster
-- in commit 4a1638c, 06 Nov 2017)The message becomes: