Remove a file from last commit
# put files back to staging
$ git reset --soft HEAD^
# unstage the file
$ git reset -- file.mdShow all local and remote Branches
$ git branch -aTo remove a specific commit from history, rebase it.
- Find out the hash from the previous commit of the one you want to delete via
g l - Start interactive rebase:
git rebase -i <HASH-PREVOUS-COMMIT> - Then remove the commit from the opened rebase message in your editor. Save and close.
- Now, force push everything
git push --force-with-lease origin master.
To remove or convert files in the git history, use BFG (brew install bfg).
$ bfg --convert-to-git-lfs '*.mv4' --no-blob-protection
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive