## Quick Git Tips - undo a "git add" ``` git reset ``` - undo change to a file ``` git restore ``` - undo a "git rebase" ``` git reset --hard ORIG_HEAD ``` - hard reset to remote ``` git reset --hard origin/main ``` - aliasing a git command ``` git config --global alias.co checkout ``` - clean *ALL* untracked files (this will cause unrecoverable damage, make sure what you are doing. ``` git clean -fd ``` - track a remote branch Older versions of git: ``` git checkout --track ``` Newer versions of git: ``` git checkout ``` - find where your package is installed ``` brew --prefix ``` - cache your github password ``` git config --global credential.helper cache ``` - change the default password cache timeout, ``` git config --global credential.helper 'cache --timeout=86400' ``` - delete a remote branch ``` git push origin --delete ``` - configure your git signature ``` git config --global user.name "stormy/cli" git config --global user.email "chengcli@umich.edu" ```