预测git commit ID并提交包含该提交ID的文件 [英] Predict git commit id and commit a file which contains that commit id

查看:115
本文介绍了预测git commit ID并提交包含该提交ID的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何做这样的事情:

  1. 使用以下内容创建一个:

  1. Create a with following content:

$ cat testfile.txt
该文件将使用以下ID提交:83b90a07620ef578450c40a6d38bacc42de7ad2d

$ cat testfile.txt
This file will be committed with this id: 83b90a07620ef578450c40a6d38bacc42de7ad2d

提交testfile.txt
$ git add testfile.txt
$ git commit -m'谢谢'

Commit testfile.txt
$ git add testfile.txt
$ git commit -m 'Thank you'

执行git日志以验证预测的提交ID:
$ git log
提交83b90a07620ef578450c40a6d38bacc42de7ad2d
作者:rohit01< * @ gmail.com>
日期:2014年2月21日星期五23:46:52 +0530

Execute git log to verify predicted commit id:
$ git log
commit 83b90a07620ef578450c40a6d38bacc42de7ad2d
Author: rohit01 <*@gmail.com>
Date: Fri Feb 21 23:46:52 2014 +0530

基本上,预测下一个git提交ID并提交一个包含该提交ID的文件.

Basically, predict the next git commit id and commit a file which contains that commit id.

推荐答案

从密码上讲这是不可能的.

That is cryptographically impossible.

git commit ID是提交内容的SHA1哈希.
您在提交中所做的任何更改也会影响ID.

The git commit ID is an SHA1 hash of the contents of the commit.
Any change you make in the commit will also affect the ID.

这篇关于预测git commit ID并提交包含该提交ID的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆