I had a local file (.foo
) that was part of the working directory that should have been in .gitignore
.
I added the file in the .gitignore
but in the end by doing:
git add .
git commit -m "added files"
git push
So the file is now in the master branch.
I am trying to remove it but trying to do something like go to the previous SHA I get errors as a non recognised file.
What can I do to remove the file from the master branch. It is the top of the branch commit
Update
The file had been committed/deleted in the past based on git log .foo
My commit added the entry .foo
in the .gitignore
along with the file.
My commit is the not the top commit in the branch. The top commit is the merge commit for my commit.
I want to remove .foo
as I never pushed the file in my commit.