-->

Github README.md and readme.md - how to delete one

2019-07-04 23:40发布

问题:

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.

How to delete one of these files?

回答1:

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 added 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.

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/

The command line route is shown in the answer by 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?



回答2:

Simply delete one of the files and commit the deletion.

$ git rm readme.md
$ git commit
$ git push