How can I stage specific lines of file to git in NetBeans?

别说谁变了你拦得住时间么 提交于 2019-12-10 14:16:35

问题


I'm quite new to using NetBeans and today I faced a problem. I have used to stage only part of files to make better commits.

I have used vim and fugitive plug-in, where I can just move specific lines from unstaged to staged.

I can do a workaround by calling git add -p, but it would be nice to do it straight from NetBeans IDE.

Is there a mysterious way to do it simple by clicking somewhere and stage specific line(s)?


回答1:


Using git add -p is not a workaround but the way to do it.

If you need it more comfortable, fire up git gui as External Tool out of NetBeans and use it to stage lines manually.

Regardless if you get that working somehow or not: this is exactly the reason why I advocate using one tool for one task and not trying to do everything in one.

In Does netbeans ignore my git pre-commit hook?, I discussed that the Git implementation of NetBeans is far from being complete. git add -p does not seem being contained in the NetBeans Git integration plan.

NetBeans is using jgit. jgit does not provide means to stage parts of files, there's only the AddCommand that provides addFilepattern(). So the answer to your question is no, it won't work.



来源:https://stackoverflow.com/questions/11898542/how-can-i-stage-specific-lines-of-file-to-git-in-netbeans

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