Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git I have an error when merge the file

Tags:

git

In Git while merging the python files error will occurs.Please share your ideas. How to remove all pyc files and merge the content. This error occurs when it pull the updation from repository. Those pyc file gets updated frequently. when I pull updation from repository those error occurs everytime

error: The following untracked working tree files would be overwritten by merge:
    addressbook/views.pyc
    allauth/account/admin.pyc
    allauth/account/auth_backends.pyc
    allauth/account/context_processors.pyc
    allauth/account/forms.pyc
    allauth/account/management/__init__.pyc
    allauth/account/urls.pyc
    allauth/account/views.pyc
    allauth/exceptions.pyc
    allauth/socialaccount/adapter.pyc
    allauth/socialaccount/admin.pyc
    allauth/socialaccount/app_settings.pyc
    allauth/socialaccount/context_processors.pyc
    allauth/socialaccount/forms.pyc
    allauth/socialaccount/helpers.pyc
    allauth/socialaccount/providers/base.pyc
    allauth/socialaccount/providers/facebook/forms.pyc
    allauth/socialaccount/providers/facebook/locale.pyc
    allauth/socialaccount/providers/facebook/provider.pyc
    allauth/socialaccount/providers/facebook/urls.pyc
    allauth/socialaccount/providers/facebook/views.pyc
    allauth/socialaccount/providers/google/provider.pyc
    allauth/socialaccount/providers/google/urls.pyc
    allauth/socialaccount/providers/google/views.pyc
    allauth/socialaccount/providers/linkedin/provider.pyc
    allauth/socialaccount/providers/linkedin/urls.pyc
    allauth/socialaccount/providers/linkedin/views.pyc
    allauth/socialaccount/providers/oauth/__init__.pyc
    allauth/socialaccount/providers/oauth/client.pyc
    allauth/socialaccount/providers/oauth/provider.pyc
    allauth/socialaccount/providers/oauth/urls.pyc
    allauth/socialaccount/providers/oauth/views.pyc
    allauth/socialaccount/providers/oauth2/__init__.pyc
    allauth/socialaccount/providers/oauth2/client.pyc
    allauth/socialaccount/providers/oauth2/provider.pyc
    allauth/socialaccount/providers/oauth2/urls.pyc
    allauth/socialaccount/providers/oauth2/views.pyc
    allauth/socialaccount/providers/twitter/provider.pyc
    allauth/socialaccount/providers/twitter/urls.pyc
    allauth/socialaccount/providers/twitter/views.pyc
    allauth/socialaccount/signals.pyc
    allauth/socialaccount/urls.pyc
    allauth/socialaccount/views.pyc
    allauth/urls.pyc
    crispy_forms/base.pyc
    crispy_forms/bootstrap.pyc
    crispy_forms/exceptions.pyc
    crispy_forms/helper.pyc
    crispy_forms/layout.pyc
    crispy_forms/layout_slice.pyc
    crispy_forms/utils.pyc
    feeds/views.pyc
    lettertemplate/forms.pyc
    lettertemplate/views.pyc
    quorum/forms.pyc
    quorum/views.pyc
    registration/admin.pyc
    registration/forms.pyc
    registration/models.pyc
    registration/urls.pyc
    registration/views.pyc
    rosetta/polib.pyc
    rosetta/poutil.pyc
    rosetta/signals.pyc
    rosetta/storage.pyc
    rosetta/urls.pyc
    rosetta/views.pyc
Please move or remove them before you can merge.
Aborting
like image 656
user Avatar asked Nov 24 '25 08:11

user


2 Answers

.pyc files probably should not be tracked since, as you're seeing, they will change constantly. Typically build products are not stored in git for just this reason. If you have the option I would untrack them in the upstream repository.

If that's not an option your only choice is to move or delete your local .pyc files. You can do this with the following command (note: this assumes you want to delete all .pyc file at or below the current directory.

 find . -iname '*.pyc' -exec rm {} \;

After doing this you should be able to do the merge since there will be no local files to overwrite.

like image 98
asm Avatar answered Nov 25 '25 23:11

asm


This error is occurring because you're tracking .pyc files in your repository (which you shouldn't do). It was probably the result of a git add . What you should do is delete all the .pyc files with git rm, then merge again. Git won't complain, as it won't be copying repository .pyc files over the local versions.

As Nick suggested, adding .pyc and other files that don't make sense to track to a global (or repository-level) .gitignore is probably a good idea. If you do so, git add . won't automatically add these files. Check out GitHub's official list of suggested .gitignore files.

like image 44
David Cain Avatar answered Nov 25 '25 22:11

David Cain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!