docs/workspaces/git-operations.mdx
Workspaces provide integrated git operations for managing your code changes.
If you're not familiar with git, here's what you need to know:
<AccordionGroup> <Accordion title="What is a branch?"> A **branch** is a separate line of development. Think of it as a copy of your code where you can make changes without affecting the original.In Workspaces:
main) - The "original" you'll eventually merge back intovk/abc123-task) - Your copy where changes happen
</Accordion>
In Workspaces, commits happen automatically as the agent works, or you can commit manually through the terminal. </Accordion>
<Accordion title="What is a pull request (PR)?"> A **pull request** is a request to merge your changes from your working branch into the target branch. It: - Shows all your changes in one place - Lets teammates review your code - Runs automated tests (CI) - Provides a history of what was changed and why </Accordion> <Accordion title="What is rebasing?"> **Rebasing** updates your working branch with the latest changes from the target branch. It's like saying "pretend I started my work from the current state of main, not the old state."When to rebase:
The "Merge" action in Workspaces pulls the target branch INTO your working branch (the opposite direction of a PR merge). </Accordion> </AccordionGroup>
The Git section in the right sidebar shows:
| Information | Description |
|---|---|
| Repository name | Current repository with status |
| Current branch | Your working branch |
| Target branch | Branch you'll merge into |
| Uncommitted changes | Number of modified files |
| Ahead/Behind | Commits relative to target branch |
| Conflict indicator | Shows when merge conflicts exist |
Create PRs directly from your workspace.
From the Git panel:
From the command bar:
Cmd/Ctrl + KPR details:
Once created, your PR appears on GitHub with your commits, description, and CI checks running.
<Frame> </Frame>Enable Draft mode when:
For workspaces with multiple repositories:
Pull the latest changes from the target branch into your working branch.
From the Git panel:
From the command bar:
Cmd/Ctrl + K and select MergeTarget branch changes are merged into your working branch after confirmation.
The workspace checks if you're behind the target branch:
Keep your branch up to date with the target branch.
From the Git panel:
From the command bar:
Cmd/Ctrl + K and select RebaseYour commits are replayed on top of the target branch after confirmation.
If conflicts occur during rebase:
Switch the branch you're merging into.
From the Git panel:
From the command bar:
Cmd/Ctrl + K and select Change Target BranchThe workspace updates to show the new ahead/behind status.
develop to main for releasePush your commits to the remote repository.
The Push command appears when:
From the Git panel:
From the command bar:
Cmd/Ctrl + K and select PushCommits are pushed to the remote repository.
<Info> Push is contextual - it only appears when there are changes to push and a PR exists. </Info>For workspaces with multiple repositories, manage each repo independently.
Access via command bar's Repo Actions page:
| Action | Description |
|---|---|
| Create PR | Create PR for specific repository |
| Merge | Merge specific repository only |
| Rebase | Rebase specific repository |
| Change Target | Change target for specific repo |
When working across repos:
When git conflicts occur:
The workspace displays a conflict resolution dialog showing:
If you can't resolve conflicts:
Solutions:
git add . && git commit -m "WIP"git stash
</Accordion>
Solution: Rebase your branch to include the new changes:
Cmd/Ctrl + K)Solutions:
<<<<<<<, =======, >>>>>>>)Solutions:
Solutions:
git remote -v in terminal