I made a pull request and now I have to remove the .vscode folder before merging.
How can I remove the folder from my branch and then push the version without this folder again?
The .vscode folder is in my .gitignore, but is constantly ignored. I have to remove this manually.
(Assuming you're the "owner" of your feature branch, like in many workflows.)
# start from your feature branch
git checkout <feature-branch>
# undo last commit but keep changes in the working tree (and index)
git reset --soft HEAD^
# get your unwanted folder out of the index
git reset HEAD -- path/to/folder
# redo your commit, this time without the folder
git commit -m "Useful message"
# push to the remote to replace the old ref, thus needing --force
git push -f origin HEAD
At this point, the remote will just need a page refresh (to update your pull request with the new branch ref) and you'll be set to merge your branch, this time without the "bad" folder.