Deleting files in a repository – GitHub Docs

About deleting files and

directories

You can delete an individual file from the repository or from an

entire directory, including all files in the directory

.

If you try to delete a file or directory in a repository for which you do not have write permissions, we will fork the project into your personal account and help you submit a pull request to the original repository after committing the change. For more information, see “About Pull Requests.”

If the file or directory you deleted contains sensitive data, the data is still 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.”

Delete

a file Browse

  1. to 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 “Create 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 “Setting up your confirmation email address.” Choose confirmation email addresses

  10. Under the fields in the confirmation message, 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

  11. 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 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 “Create 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 “Setting up your confirmation email address.” Choose confirmation email addresses

  10. Under the fields in the confirmation message, 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

  11. Click Propose File Change.

Contact US