# Automated Removal of Dummy Deployment Commits from Main Branch (GPT-4.1/AI Instructions)
_These instructions are written for use by an AI terminal/code agent (such as GPT-4.1) to programmatically remove all "chore: dummy commit to trigger deployment" commits from the `main` branch while preserving the rest of the history and commit messages._
---
## Safety Precautions
- **Always create a backup branch before history rewriting!**
- Notify collaborators: force-pushes rewrite history and break existing clones.
- Complete/merge in-flight PRs or coordinate rebase after rewrite.
- Ensure working directory is clean, or stash any local changes.
---
## Step-by-Step AI Scripted Workflow
### 1. Create a Safety Backup
```powershell
git checkout main
git checkout -b main-backup
```
### 2. Identify the Start Point for Rebase
Find the SHA of the commit just before the **first** dummy commit (AI: substitute the result as needed):
```powershell
$firstDummy = git log --reverse --grep="chore: dummy commit to trigger deployment" --format="%H" | Select-Object -First 1
$parentSHA = git rev-parse "$firstDummy^"
echo "Parent SHA: $parentSHA"
```
### 3. Start the Interactive Rebase
```powershell
git checkout main
git rebase -i $parentSHA
```
(The editor will open. Close it immediately; you’ll automate editing the todo file next.)
### 4. Scripted Modification of the Rebase Todo File
Automate converting all dummy commits from `pick` to `drop`:
```powershell
(Get-Content .git\rebase-merge\git-rebase-todo) -replace '^pick (\w+) chore: dummy commit to trigger deployment