I've added my own image in the image folder on myWebsite and put it in github. Whenever I want to remove this from the github project, everything is fine but in the commits, my private image still exists. How to remove it completely from the commit history on GitHub.
Asked
Active
Viewed 1,469 times
1
-
Does this answer your question? [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – phd Mar 27 '20 at 11:06
-
https://stackoverflow.com/search?q=%5Bgit%5D+remove+file+history – phd Mar 27 '20 at 11:06
2 Answers
3
To remove your private image completely from the commit history on Github, you can go through the following steps:
Clone the repository to your local machine
Find the id of the commit which you want to delete using
git log -n 10
Then run the following command
git rebase -i <commit-id>
Text editor will open that will list all the commits, each commit is preceded by pick
So, manually remove those commits which you want to delete and save the file
Now, push the changes to remote repo using
git push -f origin master
Now check your github repository, that commit should have been deleted
To know more you can go through this

ESCoder
- 15,431
- 2
- 19
- 42
-
If we have 2 commit and I want to delete the second commit that is not visible in History, the third commit will be deleted automatically. It is likely that my information will be lost.I want it not to be in history. Actually I have Commit 1, 3 and 2 is deleted. – MrJahanbin Mar 27 '20 at 15:14
-
@MrJahanbin you want to delete a commit(second commit) that is not visible in history?? – ESCoder Mar 27 '20 at 17:36
-
-2
Go to your image folder and open your image. There is Bin icon in right corner. click that bin icon to delete your image.

Sidath
- 379
- 1
- 9
- 25
-
1This will create a new commit and not remove it from the history. – Jannis Lehmann Mar 27 '20 at 07:11
-
-
1This does not solve the wanted issue as he wants to remove it from the history, not from the HEAD. – Jannis Lehmann Mar 27 '20 at 08:48