How to substitute an Image in github… easily

I had this problem… if I changed an Image on github and I did the usual

git add .
git commit -m "Changed image"
git push

The image did not change. I was a bit confused about the reason why.

Finally I understood the right way to do it, so I want to share it with you (maybe it’s a trivial discovery, but maybe someone got the same issue).

What I do:

I delete the old image from my local folder (I have the new one stored somewhere).

I commit the new situation (so that the original file in github will be deleted)

git add .
git commit -m "I deleted an image"
git push

Now I put the new Image (with the same name of the old, but different content) in the local folder and I commit it and push it to github and everything works fine.

git add .
git commit -m "a new image with the same name of the old"
git push

Subscribe to the newsletter for updates
Tkinter templates
My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts