Don't worry, instead of creating a new commit with the new files:
git add . // add new files
git commit -m "Oops I forgot some files sry"
You can fix your last commit!:
git add . //add new files
git commit --ammend //commit with the ammend flag
Again, instead of creating a new commit deleting the files:
git rm . // remove files
git commit -m "Oops those files shouldn't be here sry"
You can also fix your last commit!:
git --reset soft HEAD~1 //go back one commit
git add . //add the files again
git commit //and commit again
create and checkout your new branch, and then create your old branch x commits ago (with the -f flag because it already exists, effectively moving it)
git checkout -b newbranch //create and switch to the new branch
git branch -f originalbranch HEAD~x //create the original again x commits ago
Edit ~/.gitconfig and add the following alias:
[alias]
addw = !sh -c 'git diff -w --no-color "$@" | git apply --cached --ignore-whitespace' -
Then instead of using git add to stage the changes use git addw:
git addw .
git commit -m "Changes"
When you're done, the whitespace changes are unstaged so you can add and commit them:
git add .
git commit -m "Whitespace changes"