Undo a git commit

You can always just revert the changes from a single commit by doing: git revert <commit-id> note that this creates a new commit, undoing just those changes E.g. git log –oneline d806fc9 two 18cdfa2 bye 62c332e hello c7811ee initial Say I want to revert changes in commit 18cdfa2: git revert 18cdfa2 We now have: git …

Read more

What is a Git commit ID?

Here’s an example of a commit object file, decompressed. commit 238tree 0de83a78334c64250b18b5191f6cbd6b97e77f84 parent 6270c56bec8b3cf7468b5dd94168ac410eca1e98 author Michael G. Schwern <schwern@pobox.com> 1659644787 -0700 committer Michael G. Schwern <schwern@pobox.com> 1659644787 -0700 feature: I did something cool The commit ID is a SHA-1 hash of that. $ openssl zlib -d < .git/objects/81/2e8c33de3f934cb70dfe711a5354edfd4e8172 | sha1sum 812e8c33de3f934cb70dfe711a5354edfd4e8172 – This includes… Full …

Read more