Delete files on GitHub

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.