Exclude specific files from 'git pull'
I have a production git repo that I only pull changes from the main repo into; I never change this repo or do commits/pushes from here. I recently accidentally pushed some untracked (at least I thought they were) image files to the main repo from my local dev repo. Now when I try to pull the latest from the main repo, git reports an error regarding overwriting the exiting image file with the file from the main repo. I don’t even want this file from the repo (it’s located in a ,gitignored directory on the production repo)
How can I a) get rid of these unwanted image files in my main repo, or b) exclude these files from my git pull?
- Git Workflow Pull vs Fetch
- Git: pull doesn't get up-to-date squashed commit
- Using GIT, how can I selectively pull / merge changes from another's 'fork'?
- Push local git repo with sub repos (vim)
- Why git doesn't allow pull changes in files with uncommitted changes?
- Git pull change log
2 Solutions collect form web for “Exclude specific files from 'git pull'”
This allowed me to tell git to ignore a specific file, even though it was already part of a project. All changes I make to it will be ignored:
git update-index --assume-unchanged Localization/el-GR.js
git pull is equivalent (almost) to
git fetch && git merge. You just have to invoke fetch and than merge only specific files – tutorial.