git reset --hard HEAD~1
git tag -d mytag
git push origin :refs/tags/mytag
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
(from this StackOverflow link)
git remote update --prune
git branch -a
git remote show origin
git push origin --delete <branchName> OR git push origin :<branchName>
git rebase -i HEAD~3
git reflog
git merge <SHA1-of-your-commit>
git filter-branch --force --index-filter git rm --cached --ignore-unmatch file-to-be-removed.txt' --prune-empty --tag-name-filter cat -- --all
git branch -vv
$ git branch -u origin/develop
warning: refname 'origin/develop' is ambiguous.
fatal: Ambiguous object name: 'origin/develop'.
$ git show-ref origin/develop
03d710f2208eaaa0ecbbba3826ef112c509be9aa refs/heads/origin/develop
c1b822349ae2837198cdbd56e60f5518523d72ce refs/remotes/origin/develop
git update-ref refs/heads/origin/develop (adopted from https://stackoverflow.com/a/26047558/873234)
git remote prune origin (use --dry-run flag to do a dry run)
git branch --merge | grep -v "develop" | grep -v "master" | xargs -n 1 git branch -d
Open .gitconfig file, add the following lines to make it a git alias git bclean
:
[alias]
bclean = “!f() { git branch --merge | grep -v “develop” | grep -v “master” | xargs -n 1 git branch -d; }; f”