Filetree is not refreshing after switching branches

In cloud9 IDE, I am doing simple rails app in master branch. I decided to experiment a little, so I created new branch like this:

git checkout -b experiment-branch

Then I created some controllers, models etc. but experiment fails and I do not committed it. However I dont't want to delete this branch, so I tried to go back to master:

git checkout master

and code (controllers, models etc) from the previous experiment was still there in filetree, ApplicationController etc.

I tried git reset --soft <desired-previous-commit-hash> but it not worked.

I assume the second command should return me the state of my app from before creating the branch experiment-branch . Am I right or I do something wrong?


If you have not tracked the new files you add in the experiment-branch - these are still lying around as untracked files.

Untracked files are not removed when you change branches.

You would need to clean them to remove the untracked files. use git clean -n (dry-run) to identify all the files that are untracked.

Then you could git clean -f to clean all the file shown in the dry-run. Or you could use the interactive mode git clean -I

To revert changes from tracked files, use git checkout .

Refer this post for more details.

链接地址: http://www.djcxy.com/p/49264.html

上一篇: 独奏开发者的Git:合并VS rebase

下一篇: 切换分支后Filetree不刷新