Skip to main content
RapidDev - Software Development Agency
replit-tutorial

How Git workflows work in Replit

Replit has a built-in Git pane (Tools > Git) that lets you stage, commit, push, pull, and manage branches visually. For branching and merge conflict resolution, use the Git pane for basic operations and the Shell for advanced Git commands like creating branches, switching branches, and resolving merge conflicts. AI can auto-generate commit messages. Connect to GitHub for two-way sync on the main branch.

What you'll learn

  • Stage, commit, and push changes using the Git pane and Shell
  • Create and switch between Git branches for feature development
  • Resolve merge conflicts when pulling changes from GitHub
  • Set up two-way GitHub sync for team collaboration
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate9 min read15-25 minutesAll Replit plans. GitHub integration available on all plans (private repos require Core/Pro).March 2026RapidDev Engineering Team
TL;DR

Replit has a built-in Git pane (Tools > Git) that lets you stage, commit, push, pull, and manage branches visually. For branching and merge conflict resolution, use the Git pane for basic operations and the Shell for advanced Git commands like creating branches, switching branches, and resolving merge conflicts. AI can auto-generate commit messages. Connect to GitHub for two-way sync on the main branch.

Master Git Workflows in Replit: Branch, Commit, Push, and Merge

This tutorial covers the complete Git workflow inside Replit, from basic commits to branching strategies and merge conflict resolution. You will use both the visual Git pane for everyday operations and the Shell for advanced Git commands. This guide is for developers who want version control integrated into their Replit workflow, whether working solo or with a team.

Prerequisites

  • A Replit account (any plan)
  • A Replit App with code you want to version-control
  • A GitHub account (optional but recommended for remote sync)
  • Basic understanding of Git concepts (commit, branch, merge)

Step-by-step guide

1

Initialize Git and connect to GitHub

Open the Git pane by clicking Tools in the left sidebar and selecting Git. If your project does not have Git initialized, Replit will prompt you to set it up. Click 'Initialize Git repository' to create a local repo. To sync with GitHub, click 'Connect to GitHub,' authorize Replit if prompted, and either create a new repository or link an existing one. Once connected, your Repl syncs bidirectionally with the GitHub repository on the main branch.

Expected result: The Git pane shows your repository status. If connected to GitHub, the remote URL appears. Unstaged changes show as modified files.

2

Stage and commit changes using the Git pane

The Git pane shows all modified, added, and deleted files. Click the checkbox next to each file you want to include in your commit, or click the top-level checkbox to stage all changes. Enter a commit message in the text field at the top of the pane. Replit Agent can auto-generate a commit message by clicking the AI icon next to the message field. Click 'Commit' to create the commit. Your changes are now saved locally in Git but not yet pushed to GitHub.

Expected result: The commit appears in your Git history. The Git pane clears the staged files and shows a clean working state (unless there are more uncommitted changes).

3

Push commits to GitHub

After committing, click the 'Push' button in the Git pane to send your commits to GitHub. If this is the first push, Replit creates the remote branch on GitHub. Subsequent pushes add your new commits to the existing branch. If someone else has pushed changes to the same branch since your last pull, Replit will prompt you to pull first. Always pull before pushing to avoid rejected pushes.

Expected result: Your commits appear on the GitHub repository. The Git pane shows that local and remote are in sync.

4

Create and switch branches using Shell

While the Git pane handles basic commit and push operations, branch management is best done through Shell. Open Shell (Tools > Shell) and use standard Git commands to create and switch branches. Creating a branch lets you develop features in isolation without affecting the main codebase. When the feature is ready, you merge it back into main. This is the standard Git workflow used in professional software development.

typescript
1# Create a new branch and switch to it
2git checkout -b feature/user-auth
3
4# List all branches (local and remote)
5git branch -a
6
7# Switch to an existing branch
8git checkout main
9
10# Switch back to your feature branch
11git checkout feature/user-auth
12
13# Push a new branch to GitHub
14git push -u origin feature/user-auth

Expected result: You can create, list, and switch between branches. The file tree updates to show the files from the current branch.

5

Pull changes and resolve merge conflicts

When collaborators push changes to the same branch, you need to pull their changes before pushing yours. Click 'Pull' in the Git pane or run 'git pull origin main' in Shell. If there are merge conflicts (two people edited the same lines), Replit highlights the conflicting sections with Git's standard conflict markers (<<<<<<, =======, >>>>>>). Open each conflicted file, decide which version to keep (or combine both), remove the conflict markers, save the file, and commit the resolution.

typescript
1# Pull latest changes from GitHub
2git pull origin main
3
4# If conflicts occur, open the conflicted files.
5# You will see markers like:
6# <<<<<<< HEAD
7# your changes here
8# =======
9# their changes here
10# >>>>>>> origin/main
11
12# After resolving conflicts in the editor:
13git add .
14git commit -m "Resolve merge conflicts in auth module"

Expected result: Conflicts are resolved, the merge commit is created, and your branch is up to date with both your changes and the remote changes.

6

Merge a feature branch back into main

When your feature is complete and tested, merge it back into the main branch. Switch to main, pull the latest changes, then merge your feature branch. If there are no conflicts, Git performs a fast-forward or automatic merge. Push the updated main branch to GitHub. For team projects, consider using GitHub Pull Requests instead of direct merges, which allow code review before merging. The RapidDev team recommends using Pull Requests for any project with more than one contributor.

typescript
1# Switch to main branch
2git checkout main
3
4# Pull latest changes
5git pull origin main
6
7# Merge your feature branch
8git merge feature/user-auth
9
10# Push the merged main branch
11git push origin main
12
13# Optionally delete the feature branch
14git branch -d feature/user-auth
15git push origin --delete feature/user-auth

Expected result: The feature branch changes are now part of main. The Git log shows the merge. The feature branch can be safely deleted.

Complete working example

git-workflow-reference.sh
1#!/bin/bash
2# Git Workflow Reference for Replit Shell
3# Run these commands in the Shell tab (Tools > Shell)
4
5# === INITIAL SETUP ===
6# Initialize Git (if not using the Git pane)
7git init
8git add .
9git commit -m "Initial commit"
10
11# Connect to GitHub remote
12git remote add origin https://github.com/user/repo.git
13git push -u origin main
14
15# === DAILY WORKFLOW ===
16# Pull latest changes before starting work
17git pull origin main
18
19# Check status of your changes
20git status
21
22# Stage specific files
23git add src/components/Auth.jsx src/utils/api.js
24
25# Or stage all changes
26git add .
27
28# Commit with a descriptive message
29git commit -m "Add JWT token refresh logic to auth module"
30
31# Push to GitHub
32git push origin main
33
34# === BRANCHING ===
35# Create and switch to a feature branch
36git checkout -b feature/payment-integration
37
38# Work on the feature, then commit
39git add .
40git commit -m "Add Stripe payment form component"
41
42# Push the feature branch to GitHub
43git push -u origin feature/payment-integration
44
45# Switch back to main when done
46git checkout main
47git pull origin main
48git merge feature/payment-integration
49git push origin main
50
51# Clean up the feature branch
52git branch -d feature/payment-integration
53
54# === USEFUL COMMANDS ===
55# View commit history
56git log --oneline -10
57
58# See what changed in a specific file
59git diff src/App.jsx
60
61# Undo changes to a specific file (before committing)
62git checkout -- src/App.jsx
63
64# View all branches
65git branch -a

Common mistakes

Why it's a problem: Pushing directly to main without pulling first, causing rejected pushes

How to avoid: Always run 'git pull origin main' before pushing. The Git pane will also prompt you to pull if the remote is ahead.

Why it's a problem: Seeing 'Git Error UNAUTHENTICATED Failed to authenticate with the remote'

How to avoid: Go to replit.com/integrations, disconnect GitHub, and reconnect it. This refreshes the OAuth token. For private repos, you may also need a Personal Access Token stored in Secrets.

Why it's a problem: Leaving merge conflict markers (<<<<<<, =======, >>>>>>) in the code

How to avoid: Search your project files for '<<<<<<' to find unresolved conflicts. Remove all conflict markers and keep only the code you want, then commit the resolution.

Why it's a problem: Making all changes directly on main instead of using feature branches

How to avoid: Create a feature branch before starting work: 'git checkout -b feature/my-feature'. This keeps main stable and allows you to discard changes easily if needed.

Why it's a problem: Forgetting to push the new branch to GitHub before creating a Pull Request

How to avoid: After committing on a feature branch, run 'git push -u origin feature/branch-name' to create the remote branch. Then create a Pull Request on GitHub.

Best practices

  • Pull from GitHub before starting new work each session to avoid merge conflicts
  • Commit frequently with descriptive messages that explain why the change was made
  • Use feature branches for any change that takes more than a few minutes to complete
  • Name branches with prefixes (feature/, bugfix/, hotfix/) for clear organization
  • Use GitHub Pull Requests for code review before merging into main on team projects
  • Let Replit Agent generate commit messages for routine changes to save time
  • Never force-push to main since it can destroy team members' work
  • Test your code before merging feature branches back into main

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I'm working on a team project in Replit and we keep getting merge conflicts when multiple people edit the same files. Help me set up a Git branching workflow where each person works on feature branches and merges via Pull Requests. Include the Git commands for Replit Shell.

Replit Prompt

I need to create a feature branch called 'add-dashboard' and move my recent uncommitted changes to it. Help me create the branch, stage my changes, commit them, and push the branch to GitHub. Then explain how to create a Pull Request to merge it into main.

Frequently asked questions

Yes. The Git pane (Tools > Git) provides visual repository management for staging, committing, pushing, and pulling. For advanced operations like branching, merging, and conflict resolution, use Git commands in the Shell tab.

Yes. When committing via the Git pane, click the AI icon next to the commit message field. Agent analyzes your staged changes and generates a descriptive commit message automatically.

Go to replit.com/integrations and re-authorize your GitHub connection. This is the most common Git error and is caused by an expired OAuth token. If the error persists, try disconnecting and reconnecting GitHub.

The Git pane supports basic branch operations on some plans, but for full branch management (create, switch, merge, delete), use Git commands in the Shell tab. The Shell provides the complete Git CLI.

The default two-way sync works on the main branch. For other branches, you push and pull manually using Git commands in Shell. Branch switching support is available but may require the Labs feature flag in Settings.

When a pull or merge creates conflicts, Replit marks conflicted files with Git's standard markers (<<<<<<, =======, >>>>>>). Open each file, choose which version to keep, remove the markers, save, stage the files, and commit the resolution.

Yes. The RapidDev engineering team can help establish branching strategies, code review workflows, and CI/CD pipelines for teams building on Replit. This includes setting up GitHub integration, Pull Request templates, and automated testing.

Replit's built-in Git pane only integrates with GitHub natively. For GitLab or Bitbucket, use Git commands in Shell to push and pull manually. The full Git CLI is available, including the 'glab' command for GitLab.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.