I
I
Ivan Kulakov2021-03-16 18:34:32
git
Ivan Kulakov, 2021-03-16 18:34:32

How to leave readme.md only on github?

Can you tell me how to leave the readme.md file only on the github, and make it so that it does not fall into the local repository? Tried via .gitignore, but it still shows up on the local machine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2021-03-17
@ivankprod

Adding a .gitignore file does not remove the file from the repository. It only prevents the file from being automatically added to the repository at the next indexing (for example, through git add .), but even ignore does not prevent us from starting to track any file by simply forcibly adding it to the index git add <file>
. Once you add a file to the repository, you will no longer be able to remove it from there. This is if we understand by the repository its entire base with all its history.
But the file can be removed from the current state of the default branch. This is what we see when we enter the project page in the github in the list of files. And what is in the working copy on the computer.
If the file interferes with the local machine, then use another branch for local work. Not the one shown by default on github. And delete the file in this branch.
The file, of course, will not disappear from the history of the local copy of the repository, but will disappear from the local working copy of the project files and will not be an eyesore.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question