You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hello @Nagaraja and thank you for reaching out to Community!
As per what is described in How git sha1 is created the following information is used by git to generate a commit hash :
- The source tree of the commit (which unravels to all the subtrees and blobs)
- The parent commit sha1
- The author info (with timestamp)
- The committer info (right, those are different!, also with timestamp)
- The commit message
So won't be able to exactly recreate the same commit hash as several variables, such as the commit parents, the date of the commit, and the author will influence the generated hash of the new commit.
Could you elaborate more on why would you like to recreate a commit with the same SHA?
If you are looking to back up your repositories, we would suggest executing a mirror clone of it:
git clone --mirror <repository URL>
as it will include all the objects/references that are stored in the remote end.
Let us know in case you have any questions.
Thank you, @Nagaraja !