git Github README.md 和 readme.md - 如何删除一个?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12130498/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github README.md and readme.md - how to delete one?
提问by ljgww
Somehow I endup with having README.md and readme.md on github. Now these two influence each other so my GitHub.app gets completely confused. Github web site do not have any file delete function.
不知何故,我最终在 github 上拥有了 README.md 和 readme.md。现在这两者相互影响,所以我的 GitHub.app 变得完全混乱。Github 网站没有任何文件删除功能。
How to delete one of these files?
如何删除这些文件之一?
回答by ThiefMaster
Simply delete one of the files and commit the deletion.
只需删除其中一个文件并提交删除即可。
$ git rm readme.md
$ git commit
$ git push
回答by Michael Durrant
The reason that github doesn't have a delete link or button is because a simple 'delete' goes against the nature of a Source Control Version System. The way to remove a file is to remove it locally, usually with a terminal window and the command line with git rm
, commit that change - always with a message - and then 'push' that delete to the repository. If the file is present locally but never git add
ed to git you can just rm filename
the file - but warning, there's no 'confirm' normally at the command line with rm
!
Admittedly, github could have looked to 'package' that all up into a delete page link that, given a text description for reason, could do that but it would be too much 'black magic' and misleading to users learning git and how to use github.
github 没有删除链接或按钮的原因是因为简单的“删除”违背了源代码控制版本系统的性质。删除文件的方法是在本地删除它,通常使用终端窗口和命令行git rm
,提交更改 - 总是带有消息 - 然后将删除的“推送”到存储库。如果文件在本地存在但从未git add
编辑过 git,您可以只使用rm filename
该文件 - 但警告,在命令行中通常没有“确认” rm
!
诚然,github 本来可以将所有内容“打包”到一个删除页面链接中,根据原因给出文本描述,可以这样做,但这会是太多的“黑魔法”并误导用户学习 git 和如何使用github。
If you want a gui option, there are a lots of git gui tools out there. As you are on a mac, gitx , git-tower and source-tree are all tools that may help. There is also the basic mac-github tool at
http://mac.github.com/
如果你想要一个 gui 选项,那里有很多 git gui 工具。当您使用 Mac 时, gitx 、 git-tower 和 source-tree 都是可以提供帮助的工具。在http://mac.github.com/也有基本的 mac-github 工具
The command line routeis shown in the answer by ThiefMaster
该命令行路线在由ThiefMaster答案所示
More info on the overall git process and what the various commands and concepts are can also be found at: git branch, fork, fetch, merge, rebase and clone, what are the differences?
更多关于整个 git 过程以及各种命令和概念的信息也可以在:git branch、fork、fetch、merge、rebase 和 clone,有什么区别?