A
A
Alexander Karpov2018-04-26 09:38:48
git
Alexander Karpov, 2018-04-26 09:38:48

How to remove a file from tracking in GIT?

We also know about git rm and .gitignor about git rebase, but so far we have not been able to solve this case with it.
So. What's the question?
It is necessary to remove the file or folder from tracking (for example, in the master branch), similar to how it would be done by a command
git rm --cache filename
, with one exception, so that the other participants do not delete the
git pull origin master
file filename when they do.
At the same time, it is very desirable that GIT generally forgets that this file was ever tracked, in other words, that the delta of this file does not take up space in the repository and does not have any references to it.
I believe that a git rebase is needed here with a change in the commit when this file was added to the repository, but so far I have not received anything explicit.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor, 2018-04-26
@Inkognitoss

1. Impossible. Only if everyone makes a git rm --cached filecommit before the merge.
2. https://help.github.com/articles/removing-sensitiv...

S
Saboteur, 2018-04-26
@saboteur_kiev

No way. It is impossible to remove a file from the repository with all its history without cloning the project from scratch by all developers.
That is, on one particular repository, you can delete locally, but if another developer simply uses git fetch / pull, nothing will be deleted from him, and the history from his repository will be returned to you at the first git push.
The only way is to delete the file on the central repo (you can use the BFG library), then ALL developers, all jobs in teamcity / jenkins delete their repository and do a git clone. Or they also launch BFG.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question