Does git eliminate files when deleted from a remote machine?
1 answer
git pull
is actually a shortcut to two commands:
This fetches files from remote. You have a chance to interrupt it.
git fetch
This merges the changes into your local branch. Done in milliseconds
git merge
So, about the ability to trim files:
- As Thomas Kilian says, a git process starts a separate thread in it. So it's not easy to interrupt.
- If you interrupt
git pull
(close your console, or your internet connection drops, or whatever), you actually interruptgit fetch
. Since the fetch is incomplete, no truncated files will be merged into your branch. Repeatgit fetch
orgit pull
, let it finish and you have valid copies of your files. - If by accident git was able to merge an invalid state (say, the power went out during the merge), you always have a previous commit. Do it
git reset --hard <last-valid-commit-sha1>
.
+3
source to share