diff --git a/docs/smartui-baseline-management.md b/docs/smartui-baseline-management.md
new file mode 100644
index 000000000..c46744396
--- /dev/null
+++ b/docs/smartui-baseline-management.md
@@ -0,0 +1,173 @@
+---
+id: smartui-baseline-management
+title: Baseline Management in SmartUI
+sidebar_label: Baseline Management
+description: Learn how to effectively manage baselines in SmartUI for visual regression testing, including dynamic baseline specification and baseline marking.
+keywords:
+ - Baseline Management
+ - Dynamic Baseline
+ - Baseline Marking
+ - SmartUI Git
+ - Visual Regression Testing
+ - Git Integration
+url: https://www.lambdatest.com/support/docs/smartui-baseline-management/
+site_name: LambdaTest
+slug: smartui-baseline-management/
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+---
+
+
+
+:::info
+This guide explains how to effectively manage baselines in SmartUI for your visual regression testing workflow.
+:::
+
+## Understanding Baselines
+
+A baseline in SmartUI represents the reference point for visual regression testing. It's the set of screenshots against which all future builds are compared.
+
+### Types of Baselines
+
+1. **Project Baseline**: Set in project settings, used as the default comparison point
+2. **Branch Baseline**: Specific to a branch, used when Smart Git is enabled
+3. **Dynamic Baseline**: Specified during test execution
+4. **Build Baseline**: A specific build marked as baseline
+
+## Dynamic Baseline Specification
+
+SmartUI allows you to specify baselines dynamically during test execution, providing flexibility in your testing workflow.
+
+### Branch-based Baseline
+
+```bash
+npx smartui --baselineBranch "branch-name" exec --
+```
+
+**Use Cases**:
+- Testing against a specific branch's latest approved build
+- Comparing feature branch against development branch
+- Testing hotfix against production branch
+
+### Build-based Baseline
+
+```bash
+npx smartui --baselineBuild "build-name" exec --
+```
+
+**Use Cases**:
+- Testing against a specific build version
+- Comparing against a known good build
+- Testing against a production build
+
+## Mark as Baseline
+
+SmartUI provides the ability to mark builds as baseline directly through the CLI. This overwrites the global baseline branch present in the Project Settings.
+
+### Basic Usage
+
+```bash
+npx smartui --markBaseline exec --
+```
+
+## Baseline Management Strategies
+
+### 1. Feature Development
+
+**Scenario**: Managing baselines during feature development
+
+```bash
+# 1. Set feature branch baseline
+npx smartui --baselineBranch "feature/new-login" exec --
+
+
+### 2. Hotfix Management
+
+**Scenario**: Managing baselines for hotfixes
+
+```bash
+# 1. Set production as baseline
+npx smartui --baselineBranch "production" exec --
+```
+
+### 3. Release Management
+
+**Scenario**: Managing baselines for releases
+
+```bash
+# 1. Set staging as baseline
+npx smartui --baselineBranch "staging" upload
+
+# 2. Mark release as new baseline
+npx smartui --markBaseline capture urls.json
+```
+
+## Best Practices
+
+1. **Baseline Selection**:
+ - Choose stable builds as baselines
+ - Document baseline selection criteria
+ - Regular baseline updates
+
+2. **Branch Management**:
+ - Clear branch naming conventions
+ - Document branch purposes
+ - Regular branch cleanup
+
+3. **Build Management**:
+ - Meaningful build names
+ - Document build purposes
+ - Regular build cleanup
+
+4. **Approval Process**:
+ - Clear approval criteria
+ - Document approval decisions
+ - Maintain audit trail
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Baseline Issues**:
+ - Verify baseline exists
+ - Check baseline status
+ - Review baseline history
+
+2. **Comparison Issues**:
+ - Verify build compatibility
+ - Check branch status
+ - Review comparison settings
+
+3. **Permission Issues**:
+ - Verify user permissions
+ - Check branch protection
+ - Review access settings
+
+### Getting Help
+
+If you encounter any issues with baseline management in SmartUI, please contact our support team at support@lambdatest.com.
\ No newline at end of file
diff --git a/docs/smartui-branch-merging.md b/docs/smartui-branch-merging.md
new file mode 100644
index 000000000..5926be431
--- /dev/null
+++ b/docs/smartui-branch-merging.md
@@ -0,0 +1,280 @@
+---
+id: smartui-branch-merging
+title: Branch-Level Merging in SmartUI
+sidebar_label: Merging Branches
+description: Learn how to effectively merge branches in SmartUI for visual regression testing workflow management.
+keywords:
+ - Branch Merging
+ - SmartUI Git
+ - Visual Regression Testing
+ - Git Integration
+ - Merge Strategy
+ - Branch Management
+url: https://www.lambdatest.com/support/docs/smartui-branch-merging/
+site_name: LambdaTest
+slug: smartui-branch-merging/
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+---
+
+
+
+:::info
+This guide explains how to effectively merge branches in SmartUI for managing your visual regression testing workflow.
+:::
+
+## Branch-Level Merging
+
+Branch-level merging allows you to merge visual regression test results from one branch to another, maintaining a clear history of changes and approvals.
+
+### Merge Command
+
+```bash
+npx smartui merge branch --source --target
+```
+
+### Merge Process
+
+1. **Source Branch Selection**: Identifies the latest approved build in the source branch
+2. **Target Branch Update**: Updates the target branch with the approved changes
+3. **Status Updates**: Updates build statuses in both branches
+4. **Audit Trail**: Creates a merge commit with detailed information
+5. **Build Naming**:
+ - For branch merges: `merged-branch/-`
+ - For build merges: `merged-build/-`
+
+### Example Workflow
+
+```bash
+# Merge feature branch into main
+npx smartui merge branch --source feature/new-login --target main
+# Creates: merged-branch/feature-new-login-main
+
+# Merge hotfix into staging
+npx smartui merge branch --source hotfix/security-patch --target staging
+# Creates: merged-branch/hotfix-security-patch-staging
+```
+
+### Merge Behavior
+
+1. **Latest Version Merge**: Merges the latest approved version of the source branch
+2. **Status Updates**: Updates build statuses in both branches
+3. **Audit Trail**: Maintains a detailed merge history
+4. **Merged Build Status**: The newly created merged build is always `approved`
+5. **Naming Conventions**:
+ - Branch merges: `merged-branch/-`
+ - Build merges: `merged-build/-`
+
+## Branch Merge Strategies
+
+### 1. Feature Branch Strategy
+
+**Scenario**: Merging a feature branch into main after approval
+
+```bash
+# 1. Ensure feature branch is approved
+npx smartui merge branch --source feature/new-login --target main
+
+
+### 2. Hotfix Strategy
+
+**Scenario**: Merging a hotfix into multiple branches
+
+```bash
+# 1. Merge to staging
+npx smartui merge branch --source hotfix/security-patch --target staging
+
+# 2. Merge to production
+npx smartui merge branch --source hotfix/security-patch --target production
+```
+
+### 3. Release Branch Strategy
+
+**Scenario**: Managing release branches
+
+```bash
+# 1. Create release branch
+git checkout -b release/v1.0.0
+
+# 2. Merge development into release
+npx smartui merge branch --source development --target release/v1.0.0
+
+# 3. After testing, merge to main
+npx smartui merge branch --source release/v1.0.0 --target main
+```
+
+## Best Practices
+
+1. **Merge Planning**:
+ - Plan merges in advance
+ - Document merge strategies
+ - Establish approval processes
+
+2. **Branch Management**:
+ - Keep branches up to date
+ - Clean up merged branches
+ - Maintain clear branch naming
+
+3. **Approval Process**:
+ - Establish clear approval criteria
+ - Document approval decisions
+ - Maintain audit trail
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Merge Conflicts**:
+ - Check build compatibility
+ - Verify branch status
+ - Review merge history
+
+2. **Status Issues**:
+ - Verify build status
+ - Check permissions
+ - Review approval history
+
+### Getting Help
+
+If you encounter any issues with branch merging in SmartUI, please contact our support team at support@lambdatest.com.
+
+## Pull Request Workflow with Branch Merging
+
+### Scenario: Feature Development with Multiple Iterations
+
+Let's walk through a complete workflow where a team is developing a new feature with multiple iterations and PRs.
+
+```bash
+# Initial feature development
+git checkout -b feature/new-dashboard
+
+# First iteration of changes
+npx smartui --config .smartui.json exec -- --buildName "dashboard-v1-tests"
+
+# Create first PR
+git push origin feature/new-dashboard
+# Create PR on GitHub/GitLab/etc.
+
+# After review feedback, make changes
+git commit -m "Address review comments"
+npx smartui exec -- --buildName "dashboard-v2-capture"
+
+# PR is approved and ready to merge
+# First, merge the visual changes
+npx smartui merge branch --source feature/new-dashboard --target main
+
+# Then merge the code
+git checkout main
+git merge feature/new-dashboard
+
+# Run final tests on main
+npx smartui --config .smartui.json exec -- --buildName "main-dashboard-merge"
+```
+
+### CI/CD Integration with Branch Merging
+
+Here's a GitHub Actions workflow that automates the branch merging process in your CI/CD pipeline:
+
+```yaml
+name: Visual Regression Tests with Branch Merging
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+ branches: [ main, develop ]
+
+jobs:
+ visual-tests:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: '16'
+
+ - name: Install dependencies
+ run: npm install
+
+ - name: Run SmartUI tests
+ env:
+ PROJECT_TOKEN: ${{ secrets.PROJECT_TOKEN }}
+ run: |
+ # Run different types of tests
+ npx smartui --config .smartui.json exec -- --buildName "pr-${{ github.event.pull_request.number }}-tests"
+
+ merge-visual-changes:
+ needs: visual-tests
+ if: github.event.pull_request.merged == true
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: '16'
+
+ - name: Install dependencies
+ run: npm install
+
+ - name: Merge visual changes
+ env:
+ PROJECT_TOKEN: ${{ secrets.PROJECT_TOKEN }}
+ run: |
+ # Merge visual changes from PR branch to target branch
+ # Creates: merged-branch/-
+ npx smartui merge branch --source ${{ github.event.pull_request.head.ref }} --target ${{ github.event.pull_request.base.ref }}
+```
+
+### Best Practices for PR Branch Merging
+
+1. **Before Merging**:
+ - Ensure all visual changes are approved
+ - Run final tests on the feature branch
+ - Document any special merge considerations
+ - Note the expected merge naming conventions:
+ - Branch merges: `merged-branch/-`
+ - Build merges: `merged-build/-`
+
+2. **During Merge**:
+ - Use descriptive build names
+ - Include PR number in build names
+ - Run tests after merge
+ - Verify merge naming follows conventions
+
+3. **After Merge**:
+ - Verify merged changes
+ - Clean up old builds
+ - Update documentation
+ - Check merge naming in SmartUI dashboard
+
+:::note
+The branch merging process works consistently across all SmartUI CLI commands (`exec`, `capture`, `upload`, `upload-figma-web`, `upload-figma-app`), ensuring a unified experience whether you're executing tests, capturing screenshots, uploading images, or comparing Figma designs with web pages or mobile apps. Each command supports the `--buildName` flag to provide custom names for your builds.
+:::
\ No newline at end of file
diff --git a/docs/smartui-build-merging.md b/docs/smartui-build-merging.md
new file mode 100644
index 000000000..2a1303fab
--- /dev/null
+++ b/docs/smartui-build-merging.md
@@ -0,0 +1,189 @@
+---
+id: smartui-build-merging
+title: Build-Level Merging in SmartUI
+sidebar_label: Build Merging
+description: Learn how to effectively merge builds in SmartUI for granular control over your visual regression testing workflow.
+keywords:
+ - Build Merging
+ - SmartUI Git
+ - Visual Regression Testing
+ - Git Integration
+ - Build Management
+ - Build Promotion
+url: https://www.lambdatest.com/support/docs/smartui-build-merging/
+site_name: LambdaTest
+slug: smartui-build-merging/
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+---
+
+
+
+:::info
+This guide explains how to effectively merge builds in SmartUI for granular control over your visual regression testing workflow.
+:::
+
+## Build-Level Merging
+
+Build-level merging provides granular control over specific builds, allowing you to merge individual build results and manage your visual regression testing at a more detailed level.
+
+### Merge Command
+
+```bash
+npx smartui merge build --source --target
+```
+
+### Merge Process
+
+1. **Build Selection**: Identifies the source and target builds
+2. **Content Merge**: Merges the visual regression results
+3. **Status Update**: Updates build statuses
+4. **Confirmation**: Provides merge confirmation
+
+### Example Workflow
+
+```bash
+# Merge specific builds
+npx smartui merge build --source build-123 --target build-456
+
+# Merge with status update
+npx smartui merge build --source build-123 --target build-456
+```
+
+### Merge Behavior
+
+1. **Build Merging**: Merges the source build into the target build
+2. **Status Updates**: Updates the new merged build status to "approved"
+3. **Content Updates**: Updates target build with merged content
+4. **Confirmation**: Provides detailed merge confirmation
+5. **Build Naming**:
+ - For branch merges: `merged-branch/-`
+ - For build merges: `merged-build/-`
+
+
+## Build Merge Strategies
+
+### 1. Build Promotion Strategy
+
+**Scenario**: Promoting specific builds across environments
+
+```bash
+# 1. Merge staging build to production
+npx smartui merge build --source staging-build-123 --target prod-build-456
+
+
+### 2. Feature Build Strategy
+
+**Scenario**: Managing feature-specific builds
+
+```bash
+# 1. Merge feature build into main build
+npx smartui merge build --source feature-build-789 --target main-build-101
+
+
+### 3. Hotfix Build Strategy
+
+**Scenario**: Managing hotfix builds
+
+```bash
+# 1. Create hotfix build
+npx smartui capture --name hotfix-build-202
+
+# 2. Merge into production build
+npx smartui merge build --source hotfix-build-202 --target prod-build-456
+```
+
+## Advanced Build Merging
+
+### Force Merge
+
+When you need to merge builds regardless of their current status:
+
+```bash
+npx smartui merge build --source build-123 --target build-456 --force
+```
+
+### Selective Merge
+
+Merge specific screenshots from one build to another:
+
+```bash
+npx smartui merge build --source build-123 --target build-456
+```
+
+### Status Management
+
+Manage build statuses during merge:
+
+```bash
+# Merge and mark as approved
+npx smartui merge build --source build-123 --target build-456
+
+# Merge and mark as baseline
+npx smartui merge build --source build-123 --target build-456
+```
+
+## Best Practices
+
+1. **Build Management**:
+ - Use meaningful build names
+ - Document build purposes
+ - Regular cleanup of old builds
+
+2. **Merge Planning**:
+ - Plan merges in advance
+ - Document merge strategies
+ - Establish approval processes
+
+3. **Status Management**:
+ - Clear status tracking
+ - Document status changes
+ - Maintain audit trail
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Merge Conflicts**:
+ - Check build compatibility
+ - Verify build status
+ - Review merge history
+
+2. **Status Issues**:
+ - Verify build status
+ - Check permissions
+ - Review approval history
+
+3. **Permission Issues**:
+ - Verify user permissions
+ - Check build protection
+ - Review access settings
+
+### Getting Help
+
+If you encounter any issues with build merging in SmartUI, please contact our support team at support@lambdatest.com.
\ No newline at end of file
diff --git a/docs/smartui-cli-git-branching.md b/docs/smartui-cli-git-branching.md
index e9715f4e5..d51b87fd5 100644
--- a/docs/smartui-cli-git-branching.md
+++ b/docs/smartui-cli-git-branching.md
@@ -1,7 +1,7 @@
---
id: smartui-cli-git-branching-strategy
title: Branching Strategy in SmartUI SDK
-sidebar_label: Baseline Branching Strategy
+sidebar_label: Default Branching Strategy
description: In this documentation, learn how the Git Branching Strategy is implemented for the SmartUI SDK
keywords:
- Visual Regression
diff --git a/docs/smartui-smart-git-strategy.md b/docs/smartui-smart-git-strategy.md
new file mode 100644
index 000000000..2742c3c24
--- /dev/null
+++ b/docs/smartui-smart-git-strategy.md
@@ -0,0 +1,209 @@
+---
+id: smartui-smart-git-strategy
+title: Smart Git Strategy in SmartUI
+sidebar_label: Smart Git Strategy
+description: Learn about SmartUI's Smart Git feature that provides intelligent branch comparison and management capabilities for visual regression testing.
+keywords:
+ - Smart Git
+ - Dynamic Branch Comparison
+ - SmartUI Git Strategy
+ - Visual Regression Testing
+ - Git Integration
+ - Branch Comparison
+url: https://www.lambdatest.com/support/docs/smartui-smart-git-strategy/
+site_name: LambdaTest
+slug: smartui-smart-git-strategy/
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+---
+
+
+
+:::info
+Smart Git is an advanced feature in SmartUI that provides intelligent branch comparison and management capabilities. This guide explains how to use Smart Git effectively in your visual regression testing workflow.
+:::
+
+## What is Smart Git?
+
+Smart Git is a feature that enhances the default Git branching strategy in SmartUI by providing more flexible and intelligent branch comparison capabilities. When enabled, it automatically compares the latest build of a branch against the latest approved version of the same branch, regardless of the project's baseline settings.
+
+### Key Benefits
+
+1. **Intelligent Comparison**: Automatically compares against the latest approved version of the same branch
+2. **Flexible Workflow**: Works independently of project baseline settings
+3. **Easy Configuration**: Simple environment variable toggle
+4. **Fallback Support**: Gracefully falls back to default behavior when disabled
+
+## Enabling Smart Git
+
+Smart Git can be enabled using an environment variable:
+
+
+
+
+```bash
+export SMART_GIT=true
+```
+
+
+
+
+```bash
+set SMART_GIT=true
+```
+
+
+
+
+## How Smart Git Works
+
+### Default vs Smart Git Behavior
+
+#### Default Behavior (SMART_GIT=false)
+- Compares builds against the project's configured baseline branch
+- All branches are compared against the same baseline
+- Changes must be approved in the baseline branch
+
+#### Smart Git Behavior (SMART_GIT=true)
+- Compares builds against the latest approved version of the same branch
+- Each branch maintains its own comparison history
+- Changes can be approved independently in each branch
+- **Automatic Approval**: New branches are automatically approved when first created, serving as their own baseline
+
+### Comparison Flow
+
+1. **Build Execution**:
+ ```bash
+ # Enable Smart Git
+ export SMART_GIT=true
+
+ # Run your tests
+ npx smartui --config .smartui.json exec --
+ ```
+
+2. **Comparison Process**:
+ - SmartUI identifies the current branch
+ - Finds the latest approved build in the same branch
+ - Compares the new build against the latest approved version
+ - Generates a comparison report
+
+## Use Cases and Simulations
+
+### Use Case 1: Feature Branch Development
+
+**Scenario**: You're developing a new feature in a feature branch and want to track visual changes independently.
+
+```bash
+# Create and switch to feature branch
+git checkout -b feature/new-login
+
+# Enable Smart Git
+export SMART_GIT=true
+
+# Make changes and run tests with different CLI commands
+npx smartui --config .smartui.json exec -- --buildName "feature-login-tests"
+npx smartui upload-figma-web designs.json --buildName "feature-login-designs"
+npx smartui capture urls.json --buildName "feature-login-capture"
+```
+
+**Result**:
+- Builds are compared against the latest approved version in `feature/new-login`
+- Changes can be approved without affecting the main branch
+- Independent visual regression tracking for the feature
+- First build in the new branch is automatically approved as its baseline
+
+### Use Case 2: Parallel Development
+
+**Scenario**: Multiple teams working on different features in separate branches.
+
+```bash
+# Team A: Feature branch
+git checkout -b feature/team-a
+export SMART_GIT=true
+npx smartui --config .smartui.json exec --
+
+# Team B: Different feature branch
+git checkout -b feature/team-b
+export SMART_GIT=true
+npx smartui --config .smartui.json exec --
+```
+
+**Result**:
+- Each team's changes are tracked independently
+- No interference between different feature branches
+- Teams can approve their changes without waiting for others
+
+### Use Case 3: Hotfix Development
+
+**Scenario**: Need to make urgent fixes in a hotfix branch.
+
+```bash
+# Create hotfix branch
+git checkout -b hotfix/security-patch
+
+# Enable Smart Git
+export SMART_GIT=true
+
+# Run tests
+npx smartui --config .smartui.json exec --
+```
+
+:::note
+The Smart Git management works consistently across all SmartUI CLI commands (`exec`, `capture`, `upload`, `upload-figma-web`, `upload-figma-app`), ensuring a unified experience whether you're executing tests, capturing screenshots, uploading images, or comparing Figma designs with web pages or mobile apps. Each command supports the `--buildName` flag to provide custom names for your builds.
+:::
+
+**Result**:
+- Quick visual regression testing for hotfix
+- Independent approval process
+- No impact on other branches' baselines
+
+## Best Practices
+
+1. **Branch Naming**: Use clear, consistent branch naming conventions
+2. **Regular Updates**: Keep branches up to date with their parent branches
+3. **Approval Process**: Establish clear approval criteria for each branch
+4. **Documentation**: Document branch-specific visual changes
+5. **Cleanup**: Regularly clean up old branches and their builds
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Comparison Issues**:
+ - Verify Smart Git is enabled: `echo $SMART_GIT`
+ - Check branch name: `git branch --show-current`
+ - Ensure previous builds exist in the branch
+
+2. **Approval Issues**:
+ - Verify you have necessary permissions
+ - Check if the build is in an approvable state
+ - Ensure the branch has previous approved builds
+
+### Getting Help
+
+If you encounter any issues with Smart Git, please contact our support team at support@lambdatest.com.
\ No newline at end of file
diff --git a/sidebars.js b/sidebars.js
index fc209985d..f7cfaf703 100644
--- a/sidebars.js
+++ b/sidebars.js
@@ -2840,7 +2840,7 @@ module.exports = {
type: "doc",
id: "smart-visual-regression-testing",
},
- items: ["smartui-running-your-first-project", "smartui-guided-walkthrough", "smartui-cli-git-branching-strategy", "smartui-cli-env-variables"],
+ items: ["smartui-running-your-first-project", "smartui-guided-walkthrough", "smartui-cli-env-variables"],
},
{
type: "doc",
@@ -2949,6 +2949,38 @@ module.exports = {
},
]
},
+ {
+ type: 'category',
+ collapsed:true,
+ label: 'Branching and Merging',
+ items: [
+ {
+ type: 'doc',
+ id: 'smartui-cli-git-branching-strategy',
+ label: 'Default Git Strategy',
+ },
+ {
+ type: 'doc',
+ id: 'smartui-smart-git-strategy',
+ label: 'Smart Git Strategy',
+ },
+ {
+ type: 'doc',
+ id: 'smartui-branch-merging',
+ label: 'Branch-Level Merging',
+ },
+ {
+ type: 'doc',
+ id: 'smartui-build-merging',
+ label: 'Build-Level Merging',
+ },
+ {
+ type: 'doc',
+ id: 'smartui-baseline-management',
+ label: 'Auto Baseline Management',
+ }
+ ],
+ },
{
type: "category",
collapsed: true,