gitbrute
gitbrute copied to clipboard
git commit amend is a "porcelain" command
This means that it checks defaults and error conditions causing it to either fail itself or making gitbrute fail to generate the correct commit.
Examples:
- If the existing commit has an empty commit message the commit fails and gitbrute throws away the error message (missing
cmd.Stderr = os.Stderr
line for the last bit) - The user details of the current user overwrite the user details in the commit giving the wrong commit if different.
- Timezones !! (I think?)
I suggest using git hash-object -t commit -w --no-filters --stdin
to create the commit object.
Then git update-ref refs/heads/gitbrute deadbeef26024c00b62f744f9dc0418c4ccd49b1 0000000000000000000000000000000000000000
to create a new branch (or error).
The first command generally never fails.
The second command will fail if the branch exists and you give it the zeros, but the commit still exists in the repository even then and the user can see it with git log deadbeef
This doesn't touch the work tree so it even works on a bare repository. Because of this you may also want to checkout the new branch afterwards. If you don't want to create a branch or it fails you can checkout the detached HEAD instead.