If the repo is cloned to any place other than ~/code/dotfiles, $scriptsDir will differ from the value in the current version of the file, which will dirty the working directory.
When the dotfiles script is run, $scriptsDir is set in both bashrc and bash_profile to match the current system (in reality this should happen in only one of them according to the current platform).
Put $scriptsDir (and other machine-specific values) into an external file that is .gitignore-d.
This would mean that if that file doesn't exist, the dotfiles script would need to prompt the user to set those values before it can run.
The dotfiles script could compile those scripts into a single file alongside bashrc. Then bashrc could do: if [[ -f extscriptsfile ]]; then source extscriptsfile fi
~/code/dotfiles
,$scriptsDir
will differ from the value in the current version of the file, which will dirty the working directory.