留言板

Switching git branches in eclipse leaves portlets laying around?

thumbnail
Cameron McBride,修改在12 年前。

Switching git branches in eclipse leaves portlets laying around?

Expert 帖子: 269 加入日期: 11-2-8 最近的帖子
I am new to git so I may be missing some critical detail.

1. Be in the local master branch but also have a local branch "test" created off master
2. In my eclipse I have the entire plugins-sdk imported and under git control
3. Create a new portlet in the plugins-sdk
4. Immediatly add+commit your changes
5. Switch to test
6. See in eclipse that your portlet folder is still there except has a ? on the icon (in master it has the source control icon)
7. Now you have a rogue folder in your test branch that shouldn't be there. It will be there forever unless you delete it.
8. Now create a new portlet in your test branch
9. Immediatly add+commit it
10. Switch back to the master branch
11. Now you have the rogue portlet from your test branch in master. It has the ? icon by it.

I am about to install msysgit and tortoisegit and see if they behave the same way. I am on Eclispe Indigo, which includes EGit with it.
thumbnail
jelmer kuperus,修改在12 年前。

RE: Switching git branches in eclipse leaves portlets laying around?

Liferay Legend 帖子: 1191 加入日期: 10-3-10 最近的帖子
If you switch branches everything that is not under version control will remain.
So if you compiled you your portlet there will be compiled classes, that you have not checked in. so if you switch branches the folder wont be removed. (though the source files wont be there since these *are* versioned)

You can run git clean -fd to get rid of everything not under version control