简体   繁体   中英

git checkout ignored files from other branch

I have two branches A and B. Normally I work on the B branch in which I have a bunch of ignored stuff (untracked files). Now I have had to switch to the A branch to do some testing. Right after changing from B to A, all the ignored files in the B branch are now visible on the A and blocking me to switch back to the previous branch saying:

Error: Your local changes to the following files would be overwritten by checkout:

XXXX (some files)

Please commit your changes or stash them before you switch by checkout.

I tried to stash them, but the files are still there.

What can I do?

If you use only git stash , your untracked files will be unaffected. If you want them to be stashed as well, you need to use

 git stash -u

or

 git stash --include-untracked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM