git branch --merged | grep -v \* | xargs
git branch --merged | grep -v \* | xargs git branch -D
git branch | grep -v "main" | xargs git branch -D
git commit -e --file=$(git rev-parse --git-dir)/COMMIT_EDITMSG
Try git stash apply
instead of git stash pop
to avoid losing saved changes
git stash save <message>
git stash apply stash@{#}
You know when you accidentally commit "." files this will take a while but it will walk through every committed instance of the file and directory on your branch and remove it, your will have to force the push to see results on remote. USE WITH EXTREME CAUTION
git filter-branch --tree-filter 'rm -rf <file-or-directory-to-be-removed> HEAD
Quick version, does not check the tree
git filter-branch --index-filter 'rm -rf <file-or-directory-to-be-removed> HEAD
Rebase, then replace pick with reword, save/exit, the commit window will open for editing, save and force push
git rebase -i <commit_hash>^
reword <commit_hash>
:wq