5
When I have a file on my local computer that I would like not to be uploaded to the repository on Github, I simply create a file .gitignore
and add the path file. It so happens that I would like to remove a file from the repository on Github, but keep it on my local computer.
In other words, I would like the file to be ignored after it has been part of commits previous.
What I tried to do was:
- Delete the file in the Github repository;
- Add the file path to
.gitignore
on my local computer; - Make a
push
.
Well, that didn’t work, since the push
failed and asked me to make a pull
before. Well, do the pull
updates my local directory and removes the file I’d like to keep. There’s a way to discontinue a file in a Git repository?
Related: How do I remove a folder from Git history?
– Rafael Tavares