git 清除git日志文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10903584/
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
Clear git log file
提问by R C
I want to clear the git log files so that the command git log
returns nothing. Is this possible? Is this recommended?
我想清除 git 日志文件,以便该命令不git log
返回任何内容。这可能吗?这是推荐的吗?
回答by larsks
______________________________ . \ | / .
/ / \ \ \ / /
| | ========== - - WARNING!
\____________________________\_/ / / \ \
______________________________ \ | / | \ THIS WILL DESTROY
/ / \ \ \ / /. . YOUR REPOSITORY!
| | ========== - -
\____________________________\_/ / / \ \ /
______________________________ / |\ | / .
/ / \ \ \ / /
| | ========== - - -
\____________________________\_/ / / \ \
. / | \ .
git log
displays the change history of your project. If you really want to discard all of that history, you could...
git log
显示项目的更改历史记录。如果你真的想丢弃所有的历史,你可以......
rm -rf .git
git init
...but there are a relatively small number of situations where that really makes sense.
...但在相对较少的情况下,这确实有意义。
There aren't any "git log files" that git uses to produce this output; it is iterating over the database of objects that form the history of your project. If you delete the .git
directory like this, there's no going back:
没有任何 git 用于生成此输出的“git 日志文件”;它正在迭代构成项目历史的对象数据库。如果您.git
像这样删除目录,则无法返回:
- You will not be able to retrieve previous versions of files from the repository;
- You will not be able to see how files have changed over time;
- You will not be able to restore a file you have accidentally deleted.
- 您将无法从存储库中检索以前版本的文件;
- 您将无法看到文件随时间的变化情况;
- 您将无法恢复意外删除的文件。