mcjones.ca

Git Snippets

Nuke all files not in the repo

git clean -df

-n is a dry run

Add files already deleted

git add -u .

Add files already deleted AND new files

git add -A

Switching default upstream repo

git pull <upstream>
git pull --set-upstream origin main

Updating a fork

git remote add upstream <upstream_url>
git fetch upstream
git merge <tag or branch name>