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)?
Committing Sources to a Repository To commit files to the Git repository: In the Projects window, right-click the file(s) you want to commit. In the context menu, choose Git > Commit .
Multiple please can work on the same file in GIT, it just has to be merged by the second person making a commit or push of the code.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With