Docs say:
Navigate to the repository and locate the file you want to delete.
Click on the file to open it.
Click the trash can icon ( ) labeled “Delete this file” at the top right.
There is no trash icon. It’s my repository, I have write access, can edit files and upload - but not delete!
What the hell.
RREE
September 5, 2025, 6:16pm
2
git switch my_branch
git rm file
1 Like
fatso83
September 5, 2025, 6:21pm
3
There is much to say here, but
Which docs are you talking about?
There is no trash can icon in the Github UI that I can remember of recent years
This is how you do it if doing it graphically (just a random repo of mine):
fatso83
September 5, 2025, 6:23pm
4
The real answer is of course to spend 1 hour reading Chapter 1 through 3 of the free Pro Git book. Best spent hour of my professional career. Pro Git by Scott Chacon
1 Like
mgrojo
September 5, 2025, 7:50pm
5
There was one.
The funny thing is that duckduckgo found that image on an article titled “How to Use GitHub in 2025”.
Whether a coding newb or a seasoned pro, you need to know how to use GitHub. Check out our ultimate guide on how to use GitHub in 2025, including creating repos, pull requests, and more.
I asked the copilot and got irritating answers.
Thanks to you all for the links. Today I found the delete command - I would bet that it was not there the last time - mebby I’m blind…
1 Like
Just for the fun of it I asked Grok:
I can definitely help with clear steps on how to delete a file from a GitHub branch! Here’s a straightforward guide:
Steps to Delete a File from a GitHub Branch
Option 1: Using the GitHub Web Interface
Navigate to the Repository : Go to the GitHub repository in your browser.
Switch to the Branch : Use the branch dropdown menu to select the branch containing the file you want to delete.
Locate the File : Browse to the file you want to delete.
Delete the File :
Click on the file to open it.
Click the trash can icon (or “Delete this file”) at the top-right of the file view.
Commit the Change :
Enter a commit message describing the deletion (e.g., “Removed outdated file”).
Choose whether to commit directly to the branch or create a pull request.
Click “Commit changes” or “Propose file change” if creating a pull request.
Verify Deletion : Ensure the file is removed from the branch by checking the file list or pull request.
Option 2: Using Git Command Line
Clone the Repository (if not already cloned):git clone <repository-url>
cd <repository-name>
Switch to the Branch :git checkout <branch-name>
Delete the File :git rm <file-path>
Example: git rm docs/oldfile.txt
Commit the Change :git commit -m "Deleted <file-path>"
Push to GitHub :git push origin <branch-name>
Verify Deletion : Check the branch on GitHub to confirm the file is gone.
Notes:
If the file is in a pull request, deleting it via the web interface or CLI will update the pull request automatically.
Ensure you have the necessary permissions to modify the branch.
If the branch is protected, you may need to create a pull request and get approval to merge the deletion.