Delete a single file
In general, you can directly delete the file in the file manager, or useRmCommand deleted
$ rm README.txt
At this time, the workspace is deleted, but the version library does not.
Git statusThe command will immediately tell you which files have been deleted.
$ git statusOn branch masterYour branch is up-to-date with ‘origin/master‘.Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) deleted: README.txtno changes added to commit (use "git add" and/or "git commit -a")
There are two options: First, you must delete the file from the version library, and then use the command
Git RMDelete and
CommitAnd
Push
$ git rm README.txtrm ‘README.txt‘$ git commit -m "remove README.txt"[master d17efd8] remove README.txt 1 file changed, 1 deletion(-) delete mode 100644 README.txt$ git push -u origin masterCounting objects: 3, done.Delta compression using up to 4 threads.Compressing objects: 100% (2/2), done.Writing objects: 100% (2/2), 210 bytes | 0 bytes/s, done.Total 2 (delta 1), reused 0 (delta 0)To [email protected]:itmyhome2013/mygithub.git 3c147ee..c01c174 master -> masterBranch master set up to track remote branch master from origin.
Another case is to delete the file. Because the version library still exists, you can restore the accidentally deleted file to the latest version.
$ git checkout -- README.txt
Delete folder
You can delete the folder you want to delete directly in the File Manager (take the WEB-INF folder as an example)
$ git add --all$ git commit -m "remove WEB-INF"$ git push -u origin master
Git add-A (-- all): adds information about modified or deleted files and untracted files in all tracked files to the index database.
Itmyhome
Source: http://blog.csdn.net/itmyhome1990/article/details/39672913
Welcome to the Java technology exchange group: 74955800
Delete files on GitHub