Apparently the files were added in remote repository, no matter what was the content of .gitignore
file in the origin.
As the files exist in the remote repository, git has to pull them to your local work tree as well and therefore complains that the files already exist.
.gitignore
is used only for scanning for the newly added files, it doesn’t have anything to do with the files which were already added.
So the solution is to remove the files in your work tree and pull the latest version. Or the long-term solution is to remove the files from the repository if they were added by mistake.
A simple example to remove files from the remote branch is to
$git checkout <brachWithFiles> $git rm -r *.extension $git commit -m "fixin...." $git push
Then you can try the $git merge
again
Related Posts:
- Is it possible to pull just one file in Git?
- What is the best (and safest) way to merge a Git branch into master?
- How do I force git pull to overwrite everything on every pull?
- Undo a Git merge that hasn’t been pushed yet
- Git merge hotfix branch into feature branch
- Abort a Git Merge
- How to resolve merge conflicts in a Git repository
- How can I merge multiple commits onto another branch as a single squashed commit?
- How can I merge multiple commits onto another branch as a single squashed commit?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- Why does git say “Pull is not possible because you have unmerged files”?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- The following untracked working tree files would be overwritten by merge, but I don’t care
- Why does git say “Pull is not possible because you have unmerged files”?
- The following untracked working tree files would be overwritten by merge, but I don’t care
- Git error on commit after merge – fatal: cannot do a partial commit during a merge
- There is no tracking information for the current branch
- Is there a “theirs” version of “git merge -s ours”?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- Files not updating using ‘git pull’
- The following untracked working tree files would be overwritten by merge, but I don’t care
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- git checkout tag, git pull fails in branch
- Is there a “theirs” version of “git merge -s ours”?
- Why does git say “Pull is not possible because you have unmerged files”?
- How to resolve git status “Unmerged paths:”?
- fatal: could not read Username for ‘https://github.com’: No such file or directory
- How to keep a branch synchronized/updated with master?
- Resolve Git merge conflicts in favor of their changes during a pull
- Found a swap file by the name
- Is there a git-merge –dry-run option?
- How to `git pull` while ignoring local changes?
- Git push requires username and password
- How do I delete a Git branch locally and remotely?
- What is git tag, How to create tags & How to checkout git remote tag(s)
- Difference between “git add -A” and “git add .”
- Git: Message ‘src refspec master does not match any’ when pushing commits in Git
- Squash my last X commits together using Git
- How to apply a patch generated with git format-patch?
- How to delete a remote tag?
- Updates were rejected because the tip of your current branch is behind its remote counterpart
- What does “Changes not staged for commit” mean
- git: fatal: Could not read from remote repository
- How do I update Homebrew?
- Git error when trying to push — pre-receive hook declined
- Gitignore not working
- Could not open a connection to your authentication agent
- How to get just one file from another branch?
- git checkout a single file from another branch and put in different folder
- Update Git branches from master
- Stash only one file out of multiple files that have changed with Git?
- How to find my GitHub username so that I can be found via the URL?
- Create a branch in Git from another branch
- What is HEAD in Git?
- Why git asks to enter a commit message to explain why this merge is necessary
- What are the differences between git remote prune, git prune, git fetch –prune, etc
- How to get the current branch name in Git?
- How can I git stash a specific file?
- How to name and retrieve a stash by name in git?
- Stash just a single file
- Stash just a single file
- Git – Ignore node_modules folder everywhere
- Git: cannot do a partial commit during a merge (SourceTree)
- How to undo ‘git reset’?
- fatal: Not a valid object name: ‘master’
- Git and nasty “error: cannot lock existing info/refs fatal”
- How do I delete a local repository in git?
- Throw away local commits in Git
- Hard reset of a single file
- How to remove remote origin from a Git repository
- How do I copy a version of a single file from one Git branch to another?
- Git: cannot checkout branch – error: pathspec ‘…’ did not match any file(s) known to git
- Heroku: How to change a Git remote on Heroku
- Invalid VCS root mapping – 3 errors on my project
- What is the difference between pull and clone in git?
- How do I clone a single branch in Git?
- how to reset develop branch to master
- “fatal: HttpRequestException encountered.” Error with GitHub/Bitbucket Repositories due to dropping TLS-1.0 support
- Git’s local repository and remote repository — confusing concepts
- How do I set up Eclipse/EGit with GitHub?
- Repository size limits for GitHub.com
- How do i git push specific branch?
- git push origin master does not work
- How can I see which Git branches are tracking which remote / upstream branch?
- How to answer the git prompt in npm init for a local repo
- failed to push some refs to [email protected]
- Git says “Automatic merge failed”, what does it mean?
- How to configure git bash command line completion?
- How to stop tracking and ignore changes to a file in Git?
- Does running git init twice initialize a repository or reinitialize an existing repo?
- Eclipse EGit Checkout conflict with files: – EGit doesn’t want to continue
- WordPress with Git
- WordPress Git Workflow Help
- WordPress and Git – What folders should I track?
- Pull latest stable release via git [closed]
- Why do the Roots theme CSS files not load (404)?
- Painless way to track remote Git repo for WordPress updates
- WordPress on git – need help with configuration
- How to retrieve the last modification date of all files in a Git repository