it seems like a similar question with Untrack files from git temporarily but I can't find a good-working answer for me.
I'm running a python-django server and have trouble on git merge
.
At the beginning of the project, a developer had committed all the *.pyc files on git, and these commits are used on the server as production code.
Now I have removed all the *.pyc files from the repository and make the proper .gitignore file.
But the problem occurs here.
Everything goes well till commit, but if I tried to merge it with production code, it emits an error.
Your local changes to the following files would be overwritten by merge:
Of course, the troubled files are the *.pyc files.
I assume it's because the *.pyc files are already tracked in some commits, and when trying to merge, git judge that the local *.pyc files will be removed by the commits which have 'delete: *.pyc' internally.
Describe it as an example :
Let's say I'm on branch A and want to merge branch B to branch A.
The top commit of branch B has no *.pyc file. And the top commit of branch A has *pyc files on the working tree, but they're already removed from index(stage) by git rm --cached
.
When I try git merge B
on branch A the error Your local changes to the following files would be overwritten by merge:
occurs.
Is there any feature to resolve it in git?
P.S.: I'm new in StackOverflow and not fluent in English. If I made any mistake on this question or some phrases are hard to understand, please comment on me. Thank you.
Add git-status:
I can't upload the output with real file names, but it seems like below. Just the file names differ.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: files.pyc