Git 提交所有文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4571106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:52:57  来源:igfitidea点击:

Git commit all files

gitgit-svn

提问by Dodjs


How can I commit the full project again? (I want upload all of my file upload again to heroku)


我怎样才能再次提交整个项目?(我想再次上传我所有的文件上传到heroku)

回答by jondavidjohn

git add .
git commit -a

not completely sure what you want, but to add all files and commit all changes, use this

不完全确定您想要什么,但要添加所有文件并提交所有更改,请使用此

回答by Jo Liss

I want readd all files, because I think my git slug is corrupted

我想读取所有文件,因为我认为我的 git slug 已损坏

I'm not sure what you mean by corrupted -- Git uses SHA1 hashes, and it's very very hard for things to break.

我不确定你所说的损坏是什么意思——Git 使用 SHA1 哈希,而且很难破解。

You could do find | xargs touchjust in case your mtimes got messed up, but after that, git statuswill show you reliably if your working copy matches the repo (minus anything listed in .gitignore). Generating a new commit without any changes (which is what you seem to be asking for), as with git commit --allow-empty, is verifiably going to get you the same tree and won't solve your problem.

您可以这样做find | xargs touch以防万一您的 mtime 搞砸了,但在那之后,git status如果您的工作副本与存储库匹配(减去 中列出的任何内容.gitignore),它将可靠地向您显示。与 一样,在没有任何更改的情况下生成新提交(这似乎是您所要求的),这git commit --allow-empty可以验证地为您提供相同的树并且不会解决您的问题。

So I think you'll have to bite the bullet and spend some time tracking down where exactly the corruption happened (track down broken files, see which commit changed them, etc.). It's most likely not Git's fault.

因此,我认为您必须咬紧牙关,花一些时间追踪损坏的确切位置(追踪损坏的文件,查看哪个提交更改了它们,等等)。这很可能不是 Git 的错。