Deleting files in a repository – GitHub Docs

About deleting files and

directories

You can delete an individual file in your repository or an entire directory

, including all files in the directory

.

If you try to delete a file or directory in a repository for which you don’t have write permissions, we’ll fork the project to your personal account and help you send a pull request to the original repository after you commit your change. For more information, see “About pull requests.”

If the file or directory you deleted contains sensitive data, the data will still be available in the repository’s Git history. To completely delete the file from GitHub, you must delete the history file from your repository. For more information, see

“Deleting sensitive data from a repository.”

Deleting

a file Locate

  1. the repository file that you want to delete

  2. . At

  3. the top of the file, click

  4. .

  5. Click Confirm changes…

  6. In the “

  7. Confirmation message” field, type a short, meaningful confirmation message that describes the change made to the file. You can attribute the commit to more than one author in the confirmation message. For more information, see “Creating a Multi-Author Commit.”

  8. If you have more than one email address

  9. associated with your account in GitHub.com, click the Email Address drop-down menu and select the email address you want to use as the Git author email address. Only verified email addresses appear in this drop-down menu. If you enabled email address privacy, <username>@users.noreply.github.com is the confirmation author’s default email address. For more information, see “Confirm email address settings

    .” Choose confirmation email addresses

  10. Under the confirmation

  11. message fields, decide whether you want to add your confirmation to the current branch or to a new branch. If your current branch is the default branch, you must choose to create a new branch for confirmation, and then create a pull request. For more information, see “Creating a pull request.” Branch commit options

  12. Click Propose File Change.

Delete a

directory Browse to

  1. the repository directory that you want to delete

  2. .

  3. In the upper-right corner, select the drop-down menu, then click Delete directory

    .

    Screenshot of a directory's file list. To the right of the directory name, a button, labeled with a kebab icon, is outlined in dark orange.

  4. Review the files that you will delete.

  5. Click Commit changes…

  6. In the

  7. “Confirmation message” field, type a short, meaningful confirmation message that describes the change made to the file. You can attribute the commit to more than one author in the confirmation message. For more information, see “Creating a Multi-Author Commit.”

  8. If you have more than one email address

  9. associated with your account in GitHub.com, click the Email Address drop-down menu and select the email address you want to use as the Git author email address. Only verified email addresses appear in this drop-down menu. If you enabled email address privacy, <username>@users.noreply.github.com is the confirmation author’s default email address. For more information, see “Confirm email address settings

    .” Choose confirmation email addresses

  10. Under the confirmation

  11. message fields, decide whether you want to add your confirmation to the current branch or to a new branch. If your current branch is the default branch, you must choose to create a new branch for confirmation, and then create a pull request. For more information, see “Creating a pull request.” Branch commit options

  12. Click Propose File Change.