GIT: The following untracked working tree files would be overwritten by checkout

隐身守侯 提交于 2019-12-17 12:19:28

问题


I have two branches one is called master the other is called dev I am currently in the master branch and I want to go to the dev branch to move a file to the development server. however when I perform a

$ git checkout dev

I get the message:

The following untracked working tree files would be overwritten by checkout:

pages/memclub/images/subheaders/leadership.png
pages/memclub/images/subheaders/male.png
pages/memclub/images/subheaders/marketing.png
pages/memclub/images/subheaders/training.png

I dont want to commit the files to the master, they are not ready to be pushed.


回答1:


First you'll want to add the files in question so that they're tracked by Git (you don't have to commit any changes, but Git needs to know about the files):

git add pages/memclub/images/subheaders/leadership.png pages/memclub/images/subheaders/male.png 
git add pages/memclub/images/subheaders/marketing.png pages/memclub/images/subheaders/training.png

Then you can stash your changes:

git stash 

When you're ready to start working on the files again, you can use:

git stash pop


来源:https://stackoverflow.com/questions/12323128/git-the-following-untracked-working-tree-files-would-be-overwritten-by-checkout

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