Last active
April 25, 2024 01:44
-
-
Save kilip/bde627df16c2408e5428d3cce28b7729 to your computer and use it in GitHub Desktop.
Revisions
-
kilip revised this gist
Apr 25, 2024 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,6 +30,4 @@ To sign two specific commits that are respectively 4 and 5 commits back in Git, 13. Finally, you can run `git log` to confirm that the commits have been signed. Note that rebasing can be a destructive operation, so it's important to make sure you have a backup of your repository before you start. Also, if the commits you want to sign have already been pushed to a remote repository, you'll need to force push the changes after rebasing, which can potentially cause problems for other users who have already pulled the changes. So, it's important to communicate with your team before using this approach. -
kilip revised this gist
Apr 25, 2024 . 1 changed file with 32 additions and 27 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,35 @@ Example ------- To sign two specific commits that are respectively 4 and 5 commits back in Git, you can use the `git rebase` command with the `--exec` option to sign the commits as they are being rebased. Here are the steps: 1. Get the hash of the first (older) commit you want to sign by running `git log`. 2. Run `git rebase -i HEAD~5`. 3. This will open up a text editor with a list of the last 5 commits. Replace the word "pick" with "edit" for the first commit (5) you want to sign. 4. Save and close the file. 5. Git will now start the rebase process and stop at the first commit you want to sign. 6. Run `git commit --amend --no-edit -S`. 7. Enter your GPG key passphrase when prompted. 8. Run `git rebase --continue`. 9. Git will now continue the rebase process and stop at the second commit you want to sign. 10. Repeat steps 1-7 for the second commit. 11. Run `git rebase --continue`. 12. Git will now continue the rebase process and apply the signed commits. 13. Finally, you can run `git log` to confirm that the commits have been signed. Note that rebasing can be a destructive operation, so it's important to make sure you have a backup of your repository before you start. Also, if the commits you want to sign have already been pushed to a remote repository, you'll need to force push the changes after rebasing, which can potentially cause problems for other users who have already pulled the changes. So, it's important to communicate with your team before using this approach. X::[Git - Sign Previous Commit](https://www.safjan.com/git-sign-previous-commit/) -
kilip renamed this gist
Apr 25, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
kilip created this gist
Apr 25, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ To sign two specific commits that are respectively 4 and 5 commits back in Git, you can use the git rebase command with the --exec option to sign the commits as they are being rebased. Here are the steps: Get the hash of the first (older) commit you want to sign by running git log. Run git rebase -i HEAD~5. This will open up a text editor with a list of the last 5 commits. Replace the word "pick" with "edit" for the first commit (5) you want to sign. Save and close the file. Git will now start the rebase process and stop at the first commit you want to sign. Run git commit --amend --no-edit -S. Enter your GPG key passphrase when prompted. Run git rebase --continue. Git will now continue the rebase process and stop at the second commit you want to sign. Repeat steps 1-7 for the second commit. Run git rebase --continue. Git will now continue the rebase process and apply the signed commits. Finally, you can run git log to confirm that the commits have been signed. Note that rebasing can be a destructive operation, so it's important to make sure you have a backup of your repository before you start. Also, if the commits you want to sign have already been pushed to a remote repository, you'll need to force push the changes after rebasing, which can potentially cause problems for other users who have already pulled the changes. So, it's important to communicate with your team before using this approach.