I pushed a commit to a repo where I accidentally added a file. Nobody else has merged from the remote repo so I can rewrite history. But when I remove file(unstage, not remove f
Here you go:
git checkout HEAD~ -- path/to/your/file git add path/to/your/file git commit --amend -C HEAD
git diff -p HEAD~ -- path/to/your/file | git apply -R git commit --amend -C HEAD
git reset HEAD~ -- path/to/your/file git commit --amend -C HEAD