Which signals can safely be used to kill a Git process and which not?

Update: more precise question about signals

  • git push to Heroku does not create directory with .gitignore
  • 'git mergetool' with meld fails creating a '--output $MERGED' file
  • How do I learn the process of application development by cloning an open source project from github?
  • How to copy full source without opening raw(bitbucket)
  • How to setup Push/Pull in Git?
  • How to unstash only certain files?
  • 2 Solutions collect form web for “Which signals can safely be used to kill a Git process and which not?”

    Actually, git tries quite hard to be fully transactional – i.e. it tries to never leave the repository in an inconsistent state, no matter when or how an operation is interrupted – see this question:
    Can a git repository be corrupted if a command modifying it crashes or is aborted?

    So it should not matter how you terminate the git process, if using SIGTERM, SIGKILL or the red power button. The exception, as noted in the answer above, is that the files in the working directory may be a mix of files from different branches, because the files cannot be replaced all at once.

    That said, transaction safety is hard to test (as there are many corner cases), so I would not rely 100% on git being safe in this situation. You should normally be ok, but you might hit a bug from time to time and mess up the repository.

    That depends on what GIT is doing when you try to kill it.

    If you kill it during a clone, sure it will be left in some partially incomplete state, but it’s easy to recover from that: delete the messy partial clone and clone again.

    In my experience, GIT doesn’t slaughter the files it’s managing when it fails. I’ve killed it in the middle of pushes before without much damage to the files I changed. Granted, the message log can get a little screwy.

    Without much more detail than what you’ve provided, it’s hard to say.

    Git Baby is a git and github fan, let's start git clone.