Undo with reflog

git reflog
git reset --hard HEAD@{1} # reset to 1 move ago

Global ignore config

The default localtion is $XDG_CONFIG_HOME/git/ignore or $HOME/.config/git/ignore if $XDG_CONFIG_HOME is not set.