简体   繁体   English

将文件重新上传到GitHub,没有任何更改? 这有道理吗?

[英]Re-upload file to GitHub, with no change? Does this even make sense?

Is there a way to re-upload a file to GitHub without changing it? 有没有办法在不更改的情况下将文件重新上传到GitHub? The file is a .zip, and I'm wondering if it was a corrupted file; 该文件是.zip文件,我想知道它是否已损坏? then again, if there isn't a diff, then maybe it's exactly the same. 再说一次,如果没有差异,也许完全一样。

1) Is there a way to re-upload a file, even if you haven't changed it (Ie, no changes to push). 1)有没有一种方法可以重新上传文件,即使您没有更改它(即,没有要推送的更改)。

2) In the scenario I described, does it even make sense to try? 2)在我描述的情况下,尝试甚至有意义吗?

Is there a way to re-upload a file, even if you haven't changed it (Ie, 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

And then roll it back to a commit that doesn't have that file: 然后将其回滚到没有该文件的提交:

cd copy-of-myrepo
git reset --hard 12345

And then force push it: 然后用力推动它:

git push -f origin master

And then go back to your original working copy and push it: 然后回到您的原始工作副本并将其推送:

cd /path/to/myrepo
git push origin master

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. 您始终可以通过下载zip文件,并将下载副本上的校验和与原始档案的校验和进行比较来验证zip文件的完整性。 Eg, 例如,

sha1sum myfile.zip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM