如何在git update-index -assume-unchanged之后拔出时解决对文件的本地更改?

时间:2014-05-25 09:33:34

标签: git

我有一个配置文件存储我的本地数据库连接详细信息等:application.ini

在我最初拉动项目后,会跟踪application.ini文件。 所以我决定使用:

git update-index --assume-unchanged application.ini

之后我对有关mysql连接的文件进行了更改。 一切都没问题,我确定repo上的(跟踪的)application.ini文件已更改,所以现在我使用时:

git pull

我明白了:

From github.com:username/repo
   669826e..64872d9  master     -> origin/master
Updating ef81735..64872d9
error: Your local changes to the following files would be overwritten by merge:
        application/configs/application.ini
Please, commit your changes or stash them before you can merge.

git status:

Your branch is behind 'origin/master' by 36 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working directory clean

git stash save'application.ini changes':

No local changes to save

1 个答案:

答案 0 :(得分:1)

要还原导致您出现问题的--assume-unchanged,请使用--no-assume-unchanged

执行以下命令:

$ git update-index --no-assume-unchanged application.ini

然后在执行pull之前,隐藏您的本地更改:

$ git stash

git pull:

$ git pull

弹出application.ini已从保存中保存更改:

$ git stash pop