Knowledge Drop
Last tested: Apr 7, 2020
When a user hits 'Reset Connection’ in Project Settings, Looker executes a function called revert_repo() calling two jgit commands, reset and clean:
By default, reset simply changes the HEAD the current branch is pointing at. The HEAD reference is found with a call that returns the reference id of the most recent commit to master.
When Looker performs the reset, it uses the parameter --HARD to reset both the HEAD and the index of the current working directory. You will recall that the index defines where different commits are on the git tree. Therefore, this reset --HARD essentially updates all references in the git tree, ensuring the map is accurate
Source: https://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified
- clean
Clean removes all untracked files. In the context of git reset, this means that after the tree has been updated, all files not appearing on the tree will be removed.
Why does this magically solve git problems?
If resetting the connection solves issues with being able to pull, commit or push branches, this implies that the git tree became corrupted in some way, which updating references and cleaning up files was able to resolve.