When performing a pull, if a file being updated by git is currently locked on the computer, SourceTree gives an error:
error: unable to unlink old '$file': Invalid argument
fatal: Could not reset index file to revision '$SHA'.
SourceTree will then leave the repository in a mixed state. Files that had been fetched from a remote before encountering the locked file will appear as modified and unstaged. This prevents just closing whatever program had a lock on the file and pulling again because the files are marked as unable to be overwritten, must stash or commit the changes. The user must go through the process of identifying which unstaged files were affected by this mixed state, revert the files, and then will be able to pull successfully.
If this action was performed by a command line 'git pull', git will give an option to retry unlinking the affected file, or abort. Retrying allows the user to find and remove the lock on the file before continuing, and aborting reverts the repository to the state before initiating a pull. Both of these states are much better than how SourceTree currently handles the situation.
Please add the ability to retry from this state, or abort the pull operation completely and display the error.
I previously attempted to create a Discussion about this issue but received no response. It is titled: "Unable to unlink old file issue, puts repository in inconsistent state"