I need to sequentially check out tags over a branch I created with JGit.
CheckoutCommand checkout = new Git(testRepository).checkout();
org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file target\TestRepository\server\db\scripts\postgresql\._db_script.sql6197897692249726905.tmp to target\TestRepository\server\db\scripts\postgresql\_db_script.sql
Well, it seems that using JGit in Windows may generate conflicts related to managed files sometimes. What I made for solving this recurrent issue was to execute a
git clean --force followed by a
git reset --hard before each
git checkout <ref_name>. This was totally fine for me, as I didn't need to stage changes...
The problem was that basically after using some files (even in a read-only way), they were marked as changed (I verified it with
git status). The solution explained above implied more operations, but totally solved my problem.
For further details, refer to git documentation about these actions:
And develop the appropiate implementation of these two actions with JGit: