0

I have this file called readme.html in my git Repo.

Its been there since 10 months, Have not touched it.

Today I worked with other files and did a git add --all, committed and pushed the new version.

The readme.html was not changed but I have this file called readme.4ead5bd97d0927ddb88f8f672067910a.html.

It has the same contents as readme.html.

How to deal with this and any idea why this happened ?

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
shreshta bm
  • 304
  • 4
  • 11

2 Answers2

0

Some tool has generated it as a backup or for some other reasons.

You can simply remove this file withe those commands:

# remove and commit the file
rm readme.4ead5bd97d0927ddb88f8f672067910a.html
git rm --cached readme.4ead5bd97d0927ddb88f8f672067910a.html

# just verify that  the file will be deleted
git add -A .
git status

# commit the deletion of the file
git commit -m "Deleted readme.4ead5bd97d0927ddb88f8f672067910a.html"

git push origin <branch>
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 1
    Or just `git rm readme.4ead5bd97d0927ddb88f8f672067910a.html`? – user229044 Feb 22 '16 at 21:52
  • You also have to remove it from the repo itself (history) , this is why you have to rm from the cache as well. – CodeWizard Feb 22 '16 at 21:54
  • Cool. Thank you for accepting the answer. you can also vote for it if you like. Glad to help. – CodeWizard Feb 22 '16 at 23:09
  • You can also read this answer to learn how to revert the commits/tags if needed http://stackoverflow.com/questions/34519665/how-to-move-head-checkout-revert-reflog-reset/34519716#34519716 – CodeWizard Feb 22 '16 at 23:09
0

This has nothing to do with Git. You inadvertently created that file outside of Git, at some point in history, and added it by doing git add --all.

user229044
  • 232,980
  • 40
  • 330
  • 338