-
-
Notifications
You must be signed in to change notification settings - Fork 89
Command: git submit
New in v0.5.0.
The git submit
command lets you push a set of branches to a remote all at once. This is useful for workflows involving centralized Git hosting providers, such as GitHub and GitLab, where you must push a branch in order to open a pull request/merge request.
Currently, git submit
does not create pull requests/merge requests (or equivalent for your Git hosting provider); this may change in the future. See RFC: git submit
interface for more discussion.
To update your local work on top of the remote main branch, see git sync
. If your own commit was merged into the remote main branch, then git sync
will automatically clean it up for you locally.
When run with no arguments, git submit
will force-push all branches in your current commit stack which already exist on the remote. This is meant as a shorthand to update your entire commit stack at once, useful if you've made changes to a commit earlier in the stack or if you've rebased your stack recently.
Note that force-pushing branches will overwrite public history. This is generally only recommended for branches which are under review, which no one else is using; people using your branch would have merge conflicts if they tried to pull it.
To submit a different set of branches, pass a revset expression as the argument. For example, to submit only branches pointing to the current commit, run:
$ git submit @
Or to submit all of your local branches, run:
$ git submit 'draft() & branches()'
By default, git submit
does not push branches which haven't been pushed to the remote before. This is to ensure that you don't publish work that's not ready yet, and that you don't clobber an existing branch on the remote with the same name.
To push a new branch to the remote, run git submit
with the -c
/--create
option. (You will have to create the branch first, such as with git branch <name> <target>
or git switch --create <name> <target>
or git record
with the --branch
option.)
To specify which remote should be pushed to with git submit --create
, configure the remote.pushDefault
option:
$ git config remote.pushDefault origin
This is particularly useful if your repository has different "pull" and "push" remotes, which is commonly the case when working with repository forks.
- Search the Wiki 🔎
- User guide
- Welcome
- Installation
- Tutorial
- Command overview
- General:
- Navigation:
- Committing:
- Rebasing:
- Verification:
- Collaboration:
- Workflows
- Advanced topics
- Reference
- Developer guide
- Onboarding offer
- Development
- Reference