Documentation Index
Fetch the complete documentation index at: https://mintlify.com/21st-dev/1code/llms.txt
Use this file to discover all available pages before exploring further.
Overview
1Code includes a full-featured git client built into the interface. No need to switch to your terminal for:- Viewing diffs and file changes
- Staging and committing
- Creating and switching branches
- Pushing and pulling
- Creating pull requests
- Viewing commit history
The Git Panel
Access the git panel from any active chat: Location: Right sidebar > Git tab (or click the branch icon in the header) Sections:- Current branch: Shows active branch with status indicators
- Changes: Unstaged and staged files with diffs
- Commit: Commit message input and history
- Remote: Push/pull/sync operations
- Branches: List of local and remote branches
Viewing Changes
File Change List
The changes section shows all modified files:- Modified (yellow M): Existing file changed
- Added (green A): New file created
- Deleted (red D): File removed
- Renamed (blue R): File moved/renamed
- Untracked (gray ?): New file not yet staged
X changed, Y added, Z deleted
Viewing Diffs
Click any file to see a side-by-side diff:- Left pane: Original content (before changes)
- Right pane: Modified content (after changes)
- Highlighting: Red for removed lines, green for added lines
- Line numbers: Click to reference specific lines
- Toggle between unified and split view
- Show/hide whitespace changes
- Word diff for finer granularity
Inline Diffs
Agent messages show inline diffs for files they modify:Staging and Committing
Staging Files
Stage files
Stage individual files or all at once:Individual: Click the
+ icon next to a file
All: Click Stage All button
Selective: Click file > Select lines > Stage Selected LinesS: Stage current fileU: Unstage current fileCmd+AthenS: Stage all files
Writing Commit Messages
Good commit messages help track changes: Format:Creating Commits
Atomic commits: You can also select specific files and click Commit Selected to commit only those files.
Working with Branches
Viewing Branches
The branches section shows: Current branch: Highlighted with a checkmark Local branches: Branches on your machine- Last commit date
- Ahead/behind indicators (vs. remote)
- Checked out in worktree indicator
- Latest commit info
- PR status if applicable
Creating Branches
Validation: 1Code checks for:
- Valid characters (alphanumeric, dash, slash, underscore)
- No double dots or consecutive slashes
- Unique name (not already existing)
Switching Branches
Safety check
1Code verifies you have no uncommitted changes.If you do:
- Commit your changes first
- Stash them:
git stash push -m "WIP" - Discard them (if you’re sure)
Cmd+P > type branch name > Enter
Deleting Branches
Delete options
Choose:
- Delete local: Remove branch from your machine only
- Delete local and remote: Also delete from GitHub/origin
- The current branch
- Branches checked out in other worktrees
- Protected branches (main, master) without confirmation
Remote Operations
Pushing Changes
Click push
In the git panel, click Push button.If this is your first push on this branch:
- Branch is created on remote
- Upstream tracking is set automatically
- Future pushes are faster
- ↑3: 3 commits ahead (need to push)
- ↓2: 2 commits behind (need to pull)
- ↑3 ↓2: Diverged (need to pull/rebase first)
Pulling Changes
Auto-stash: Enable in settings to automatically stash uncommitted changes before pulling.
Syncing (Pull + Push)
Click Sync to pull and then push in one operation:- Fetches latest from remote
- Rebases your commits on top
- Pushes your commits to remote
- Updates tracking information
- Keeping feature branches up-to-date with main
- Quick sync when collaborating
- Before creating a PR
Force Push
When to force push:- After amending a commit that was already pushed
- After rebasing a feature branch
- When you need to undo pushed commits
- Hold
Shiftwhile clicking Push - Confirm the force push dialog
- 1Code uses
--force-with-leasefor safety
main, master, production unless you explicitly confirm.
Creating Pull Requests
PR Details (auto-filled)
1Code pre-fills based on your commits:Title: Based on commit messages or branch nameDescription: Includes:
- Summary of changes
- List of commits
- Files changed
- Test results (if available)
.github/pull_request_template.md, it’s automatically included.
PR Status in 1Code
Once a PR exists, the git panel shows:- PR number and status (open, merged, closed)
- Review status: Approved, changes requested, pending
- CI status: Passing, failing, in progress
- Merge conflicts: If any exist
- Quick actions: View on GitHub, update branch, merge
Commit History
View past commits in the history section: Information shown:- Commit hash (short and full)
- Commit message
- Author and timestamp
- Tags (if any)
- Branch indicators
- Click to view full diff
- Copy hash for referencing
- Revert commit (creates inverse commit)
- Cherry-pick to another branch
- Search by message or hash
- Filter by author
- Date range
- Branch-specific history
Advanced Git Operations
Stashing Changes
Temporarily save uncommitted changes: Create stash:- Click Stash button
- Enter optional message: “WIP: adding feature X”
- Changes are saved and working directory is clean
- Click Stashes to see list
- Click stash to preview
- Apply: Restore without deleting stash
- Pop: Restore and delete stash
- Switching branches with WIP code
- Quick experiments without committing
- Temporarily removing changes to test something
Rebasing
Reapply commits on top of another branch: Interactive rebase:- Right-click a commit
- Select Rebase from here
- Choose operations:
- Pick: Keep commit as-is
- Reword: Change message
- Edit: Modify content
- Squash: Combine with previous
- Drop: Remove commit
- Complete rebase
- Clean up commit history before PR
- Squash WIP commits into logical units
- Update feature branch with main
Cherry-picking
Apply specific commits to current branch:- Find commit in history
- Right-click > Cherry-pick
- Commit is applied to current branch
- Resolve conflicts if any
- Complete cherry-pick
- Port bug fix from one branch to another
- Include specific feature without merging entire branch
- Recover commits from abandoned branches
Merge vs Rebase
| Operation | Merge | Rebase |
|---|---|---|
| History | Preserves complete history | Rewrites history |
| Graph | Creates merge commits | Linear history |
| Conflicts | Once, at merge time | Per commit being rebased |
| Safety | Non-destructive | Rewrites commits |
| Use for | Feature branches → main | Feature branches update |
Git Configuration
Customize git behavior in Settings > Git:User Information
Signing Commits
Enable GPG commit signing:- Generate GPG key:
gpg --gen-key - Add to GitHub: Settings > SSH and GPG keys
- Configure in 1Code: Settings > Git > Enable Signing
- All commits are now signed with your key
Auto-fetch
Automatically fetch from remote:- Never: Manual fetch only
- Every 5 minutes: Keep branches up-to-date
- On focus: When you switch to 1Code
Default Behavior
- Auto-stash on pull: Stash uncommitted changes automatically
- Prune on fetch: Remove deleted remote branches
- Fast-forward only: Prevent merge commits on pull
- Sign commits: Require GPG signature
Troubleshooting
Can't switch branches - uncommitted changes
Can't switch branches - uncommitted changes
Solution:
Push rejected - remote has changes
Push rejected - remote has changes
Cause: Someone else pushed to the branch.Solution:
- Click Pull to get their changes
- Resolve any conflicts
- Push again
Merge conflict after pull
Merge conflict after pull
Solution:
- Open conflicted files (marked with ⚠️)
- Look for conflict markers:
- Edit to keep the correct version
- Remove conflict markers
- Stage resolved files
- Click Continue Rebase or commit
Rebase failed - can't continue
Rebase failed - can't continue
Solution:
- Try to resolve conflicts as above
- If stuck, click Abort Rebase
- Everything returns to state before rebase
- Try merging instead of rebasing
Accidentally committed to wrong branch
Accidentally committed to wrong branch
Solution:Or use the Revert button in commit history.
Lost commits after rebase
Lost commits after rebase
Recovery:Reflog keeps commits for 30 days by default.
Git Best Practices
Commit Often
Make small, frequent commits rather than large, infrequent ones. Easier to review and roll back if needed.
Descriptive Messages
Write clear commit messages explaining why, not just what. Future you will be grateful.
Pull Before Push
Always pull (or sync) before pushing to avoid conflicts and rejected pushes.
Review Diffs
Always review diffs before committing. Catch accidental changes or debug output.
Branch Naming
Use consistent naming:
feature/, fix/, refactor/. Makes navigation and automation easier.Clean History
Squash WIP commits before merging. Keep main branch history readable.
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Stage file | S |
| Unstage file | U |
| Commit | Cmd+Enter |
| Push | Cmd+Shift+P |
| Pull | Cmd+Shift+L |
| Sync | Cmd+Shift+S |
| View diff | D |
| Switch branch | Cmd+B |
| Create branch | Cmd+Shift+B |
| Git panel | Cmd+G |
Next Steps
Worktrees
Learn how worktrees enable isolated development with built-in git support.
Automations
Trigger agents from git events like pushes, PR creation, or CI failures.
Background Agents
Background agents commit and push changes automatically as they work.
Configuration
Customize git behavior, signing, and integration settings.