git how to switch branches without committing your changes

好久不见. 提交于 2019-12-01 19:00:18

I'm using git 1.9.1 and it is possible to switch branches with changes in a file that's already in the tree and then skipped with git update-index --skip-worktree filename.

The file is not changed after the switch (i.e. it is not changed to the version in the branch I switched to).

(I would have thought that this is the behavior since 1.7.7 since its release notes state * "git stash" learned an "--include-untracked option". but 1.7.7 was released before you asked the question, so I don't know.)

Please note that when trying to switch to a branch that doesn't have the file git still complains with

error: Your local changes to the following files would be overwritten by checkout: f1.config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!