From 6db42074808cff79fea298df642833e75fb4ae62 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Mon, 11 Nov 2024 06:25:57 -0500 Subject: [PATCH] Clarify "removing secrets from previous commits" section (#35235) Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> --- .../working-with-push-protection-from-the-command-line.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/code-security/secret-scanning/working-with-secret-scanning-and-push-protection/working-with-push-protection-from-the-command-line.md b/content/code-security/secret-scanning/working-with-secret-scanning-and-push-protection/working-with-push-protection-from-the-command-line.md index ca6a4ea4e8fa..e1e7f9dc1e9f 100644 --- a/content/code-security/secret-scanning/working-with-secret-scanning-and-push-protection/working-with-push-protection-from-the-command-line.md +++ b/content/code-security/secret-scanning/working-with-secret-scanning-and-push-protection/working-with-push-protection-from-the-command-line.md @@ -45,7 +45,7 @@ To resolve a blocked push, you must remove the secret from all of the commits it If the blocked secret was introduced by the latest commit on your branch, you can follow the guidance below. 1. Remove the secret from your code. -1. To commit the changes, run `git commit --amend`. This updates the original commit that introduced the secret instead of creating a new commit. +1. To commit the changes, run `git commit --amend --all`. This updates the original commit that introduced the secret instead of creating a new commit. 1. Push your changes with `git push`. ### Removing a secret introduced by an earlier commit on your branch @@ -107,6 +107,7 @@ You can also remove the secret if the secret appears in an earlier commit in the 1. Save and close the editor to start the interactive rebase. 1. Remove the secret from your code. +1. Add your changes to the staging area using `git add .` 1. Commit your changes using `git commit --amend`. 1. Run `git rebase --continue` to finish the rebase. 1. Push your changes with `git push`.