0

Git beginner here..

On an old machine I've created a readme.md file for my repo on github. But now I am on a new machine and I want to delete ALL commits from the readme.md file. The problem is, that I don't have the readme.md file locally anymore. It only exists in the remote repo on github. How do I delete the commits?

Alex
  • 21
  • 1
  • 3
  • 1
    If you have the repository cloned to your new machine, the file is still in the history there. Can you clarify exactly what you're trying to do? The sentence "want to delete all commits from the readme.md file" doesn't make much sense. Commits are not per-file, they contain entire snapshots. If you were to outright remove those commits, other changes committed together with changes to that readme file would be removed as well. Most likely you want to remove that file from all commits in the repository, so that it looks like the file was never there at all. Please clarify your intent. – Lasse V. Karlsen Mar 23 '22 at 11:50
  • Hello, I have a repository that has the same name as my username on github. In this repository there is only a single file called "README.md". This file will be shown to all people who visit my github profile, so they can read something about my persona. But I want to delete the history from this file, so they can only see the current text. – Alex Mar 23 '22 at 11:59
  • So no other files? How about creating a new local repository, adding the file(s) you want in there, setting the remote to the github repository and then doing a force-push? (make sure you make a backup copy of the original repository before you attempt this) – Lasse V. Karlsen Mar 23 '22 at 14:07

0 Answers0