将文件重新上传到 GitHub,没有任何变化?这甚至有意义吗?

rba*_*att 1 git github

有没有办法在不更改文件的情况下将文件重新上传到 GitHub?该文件是一个 .zip,我想知道它是否是一个损坏的文件;再说一次,如果没有差异,那么也许它完全相同。

1) 有没有办法重新上传文件,即使您没有更改它(即没有更改推送)。

2)在我描述的场景中,尝试是否有意义?

lar*_*sks 5

Is there a way to re-upload a file, even if you haven't changed it (I.e., no changes to push).

I guess you could make a clone of the repository:

git clone git@github.com:you/yourrepo.git copy-of-myrepo
Run Code Online (Sandbox Code Playgroud)

And then roll it back to a commit that doesn't have that file:

cd copy-of-myrepo
git reset --hard 12345
Run Code Online (Sandbox Code Playgroud)

And then force push it:

git push -f origin master
Run Code Online (Sandbox Code Playgroud)

And then go back to your original working copy and push it:

cd /path/to/myrepo
git push origin master
Run Code Online (Sandbox Code Playgroud)

In the scenario I described, does it even make sense to try?

Probably not, no.

You could always verify the integrity of the zip file by downloading it and comparing a checksum on the downloaded copy against a checksum of the original archive. E.g.,

sha1sum myfile.zip
Run Code Online (Sandbox Code Playgroud)