Make the repository the source of truth
- Track application source, configuration templates, dependency locks and deployment scripts.
- Ignore secrets, uploaded media, caches, build output and local editor files unless the project requires them.
- Document the runtime versions and commands needed to produce a release.
- Keep server-only configuration outside Git and inject it during deployment.
Give each change a clear boundary
- Start from a clean, current default branch.
- Create a branch or worktree for the requested change.
- Ask the agent to make one coherent change and include tests or verification.
- Review the diff for unrelated edits, generated files and dependency changes.
- Commit only after the production build succeeds.
Identify exactly what was deployed
- Deploy a commit, tag or immutable release archive rather than whichever files happen to be on a laptop.
- Record the commit identifier with the release directory or deployment log.
- Keep the previous release and its matching environment configuration available for rollback.
- Do not rewrite shared branch history to hide a failed deployment. Revert it with a new commit.
Add automation after the manual path works
A Git push should not become a production deployment until the build, test, secret and rollback steps are understood. Automate the same verified sequence rather than inventing a second release process.
- Build the application in a clean environment.
- Stop when tests, type checks or security checks fail.
- Use a protected environment for production credentials.
- Require an approval before the production deployment job when the business needs it.
- Verify the live health endpoint and important routes after release.
Official references
Platforms and tools change over time. Use these official references for the current product documentation.