I've tried both
git update-index --assume-unchanged config/myconfig
and
editing .git/info/exclude
and adding config/myconfig
however when I do git pull I always get:
Updating 0156abc..1cfd6a5 error: Your local changes to the following files would be overwritten by merge: config/myconfig Please, commit your changes or stash them before you can merge. Aborting
What am I missing?
This question is related to
git
You most likely had the files staged.
git add src/file/to/ignore
To undo the staged files,
git reset HEAD
This will unstage the files allowing for the following git command to execute successfully.
git update-index --assume-unchanged src/file/to/ignore
If you dont want your local changes, then do below command to ignore(delete permanently) the local changes.
git checkout <filename>
or git checkout -- .
)git reset <filename>
or git reset
) and then do checkout (git checkout <filename>
or git checkout -- .
)git clean -fd
)If you dont want to loose your local changes, then stash it and do pull or rebase. Later merge your changes from stash.
git stash
, and then get latest changes from repo git pull orign master
or git rebase origin/master
, and then merge your changes from stash git stash pop stash@{0}
You probably need to do a git stash
before you git pull
, this is because it is reading your old config file. So do:
git stash
git pull
git commit -am <"say first commit">
git push
Also see git-stash(1) Manual Page.
Source: Stackoverflow.com