Git pull - error: The following untracked working tree files would be overwritten by merge:

59,112

Solution 1

My guess is that someone else has accidentally committed this file. How to resolve this:

Remove your local .pyc file

rm rtb_redis_connections/redis_connections.pyc

Do the pull

git pull

Remove the file from git and push up the changes

git rm rtb_redis_connections/redis_connections.pyc
git commit -m "Remove pyc file"
git push origin master

Assuming that you are working on the master branch that is.

Solution 2

Please move or remove them before you can merge.

Aborting

The solution is actually very simple:

git clean  -d  -fx ""
  • X - delete ignore file has not identified for git files
  • D -- deletion was not added to the git in the path of the file
  • F - forced operation

Solution 3

Why don't you put them to .gitignore?

Solution 4

You either need to add te rtb_redis_connections directory to the repository so that it tracks to the remote, or add the files or directory to .gitignore.

Share:
59,112

Related videos on Youtube

Tampa
Author by

Tampa

Updated on July 26, 2022

Comments

  • Tampa
    Tampa 4 months

    I keep getting this error when I do a git pull every 60 seconds on my monitoring server. I am using chef and a python script to "git pull" every 60 seconds.

    Updating 70fe6e8..2da34fc
    error: The following untracked working tree files would be overwritten by merge:
        rtb_redis_connections/redis_connections.pyc
    Please move or remove them before you can merge.
    Aborting
    

    How do I deal with this? these pyc files keep getting created.

  • Tampa
    Tampa over 10 years
    I do have *.pyc in .gitignore
  • robinst
    robinst over 10 years
    @Tampa Then maybe someone else committed the redis_connections.pyc file by accident.
  • Vik
    Vik over 9 years
    This is my preferred method for taking out unwanted files like logs, fast. Just remove, and commit. Thanks.
  • usumoio
    usumoio over 9 years
    @Magnus_Skog I was also able to use your solution, thank you. Is there a more sustainable way to manage this, other than just yelling at the other developers.
  • Dev Danidhariya
    Dev Danidhariya over 6 years
    dot't use this is delete all .gitignore file in your local repo.
  • Ali Haider
    Ali Haider over 6 years
    Thanks a lot. Saved me some vital time.
  • user2441441
    user2441441 over 6 years
    Explanation should be provided with the command you mentioned above.
  • ralphtheninja
    ralphtheninja about 4 years
    @usumoio Sure. You could add a *.pyc line to .gitignore to prevent people from committing it in the first place. Cheers.

Related