简体   繁体   English

如何从NetBeans的Git存储库中删除文件?

[英]How can I remove files from a Git repo in NetBeans?

I have several project config files that got stuck in the tree when I initially commited in NetBeans, and now they refuse to be removed from the commit. 我最初在NetBeans中提交时,有几个项目配置文件卡在树中,现在它们拒绝从提交中删除。 How can I remove them from within NetBeans? 如何从NetBeans中删除它们?

If you just want to delete a file in a local repo, apply the first two steps only, but I assume you want to push the changes into a remote one too. 如果您只想删除本地存储库中的文件,请仅应用前两个步骤,但是我想您也想将更改推送到远程文件中。

So here's how it goes: 所以这是怎么回事:

  1. Open the "Files" or "Projects" window 打开“文件”“项目”窗口
  2. Right click on the file(s), select "Delete" , then press OK . 右键单击文件,选择“删除” ,然后按OK
  3. In the "Projects" window, right-click the root node ( "Source Files" ), then press "Git"→"Commit" “项目”窗口中,右键单击根节点( “源文件” ),然后按“ Git”→“提交”。
  4. Approve the files to be deleted (they will be marked with yellow, and checked by default) then press Commit . 批准要删除的文件(它们将被标记为黄色,并且默认情况下已选中),然后按Commit You can optionally set the commit message too. 您也可以选择设置提交消息。
  5. Repeat step 3, but this time select "Git"→"Remote"→"Push to Upstream" 重复步骤3,但是这次选择“ Git”→“远程”→“推送到上游”

And that's it, the file changes are now pushed into the remote side. 就是这样,文件更改现在已推送到远程端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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