Skip to content

feat: add netlify push for git-based deploys via Netlify-hosted git#7949

Draft
serhalp wants to merge 1 commit intomainfrom
serhalp/frb-2117-manual-cli-deploys-can-go-through-git-like-usual-cd
Draft

feat: add netlify push for git-based deploys via Netlify-hosted git#7949
serhalp wants to merge 1 commit intomainfrom
serhalp/frb-2117-manual-cli-deploys-can-go-through-git-like-usual-cd

Conversation

@serhalp
Copy link
Member

@serhalp serhalp commented Feb 16, 2026

Summary

See https://link.excalidraw.com/l/1lDRWjiHP6a/8g721X5zal0 and https://www.notion.so/netlify/Discovery-Netlify-code-hosting-2fe1da88359a808e968bd68797af8d69 for context.

Introduce a new deploy workflow using Netlify-hosted git repositories:

  • netlify init --git: configures a site to use Netlify's git provider, sets up the netlify remote, and wires up a credential helper in ./.git/config for seamless git operations
  • netlify push: stages, commits, and pushes to the Netlify remote (which will trigger a build/deploy)
  • netlify git-credentials (hidden): git credential helper that provides the Netlify auth token for push authentication

Adds @clack/prompts for pretty CLI UX. We've been meaning to do this for years and I'd rather not keep spreading our current patterns. The dependency weight is very small.

@github-actions
Copy link

github-actions bot commented Feb 16, 2026

📊 Benchmark results

Comparing with de4d92d

  • Dependency count: 1,076 ⬆️ 0.28% increase vs. de4d92d
  • Package size: 325 MB ⬆️ 0.14% increase vs. de4d92d
  • Number of ts-expect-error directives: 364 (no change)

@serhalp serhalp force-pushed the serhalp/frb-2117-manual-cli-deploys-can-go-through-git-like-usual-cd branch from e194d8d to 43aeca5 Compare February 16, 2026 15:58
Introduce a new deploy workflow using Netlify-hosted git repositories:

- `netlify init --git`: configures a site to use Netlify's git provider, sets up the `netlify`
  remote, and wires up a credential helper in `./.git/config` for seamless git operations
- `netlify push`: stages, commits, and pushes to the Netlify remote (which will trigger a
  build/deploy)
- `netlify git-credentials` (hidden): git credential helper that provides the Netlify auth token for
  push authentication

Adds `@clack/prompts` for pretty CLI UX. We've been meaning to do this for years and I'd rather not
keep spreading our current patterns. The dependency weight is very small.
@serhalp serhalp force-pushed the serhalp/frb-2117-manual-cli-deploys-can-go-through-git-like-usual-cd branch from 43aeca5 to d94682b Compare February 16, 2026 20:52
'Configure continuous deployment for a new or existing project. To create a new project without continuous deployment, use `netlify sites:create`',
)
.option('-m, --manual', 'Manually configure a git remote for CI')
.option('--git', 'Use Netlify-hosted git for deploys (no external provider needed)')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD: what should this be called? Confusingly, --manual already exists and means something completely unrelated to "manual deploys".

Should this even be opt-in (eventually)?


export const createPushCommand = (program: BaseCommand) =>
program
.command('push')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD: what should this be called? should this even be separate from netlify deploy? how exactly does the currently checked out branch come into play?

.description('Push code to Netlify via git, triggering a build')
.option('-m, --message <message>', 'Commit message')
.addExamples(['netlify push', 'netlify push -m "Add contact form"'])
.action(async (options: OptionValues, command: BaseCommand) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixme: use the good pattern for typing options

const repo = {
provider: 'netlify-git',
repo_branch: 'main',
allowed_branches: ['main'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allowed_branches: ['main'],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant