From 49000c866228dfbfdce21781814cf72dcb2b6126 Mon Sep 17 00:00:00 2001 From: Fan-Wu Geoffrey Yang Date: Tue, 29 Sep 2026 15:37:02 +1300 Subject: [PATCH] Update Tools/Git --- Tools%2FGit.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Tools%2FGit.md b/Tools%2FGit.md index 0abd8bc..99f4a9d 100644 --- a/Tools%2FGit.md +++ b/Tools%2FGit.md @@ -33,11 +33,21 @@ git push origin 'refs/remotes/{name_of_remote}/:refs/heads/' --prune --tags
Explanation +`git rebase -i HEAD~{number_of_commits_to_go_back}` +git rebase interactively (commit by commit) from current head to number of commits ago. +--- + +git push --force-with-lease + +git force push but only if there are no new commits
+ ``` git rebase -i HEAD~{number_of_commits_to_go_back} git push --force-with-lease ``` + References: -- https://stackoverflow.com/questions/73528969/how-to-change-an-old-commit-message \ No newline at end of file +- https://stackoverflow.com/questions/73528969/how-to-change-an-old-commit-message +- https://stackoverflow.com/questions/52823692/git-push-force-with-lease-vs-force \ No newline at end of file