top of page
Logo of top retool developers and retool agency

Branching and Version Control in Retool

This article will explore the Retool source control in depth and ensure you understand everything needed to start your journey.


Benefits of Integrating Source Control with Retool


retool source control

Integrating source control with Retool is about more than just managing changes. It's about ensuring secure software development. Source control systems track modifications, enabling teams to collaborate effectively, maintain version history, and ensure all changes are deliberate and reviewed. This integration enhances accountability, prevents data loss, and facilitates the rollback of changes if necessary, instilling a sense of trust and confidence in your development process.


Support for Various Source Control Management (SCM) Providers


Retool empowers you by seamlessly integrating various Source Control Management (SCM) providers. This flexibility and compatibility with different workflows allow you to utilize your preferred SCM tools like GitHub, GitLab, and Bitbucket to manage your Retool projects. This improves productivity and streamlines your development processes, putting you in control of your workflow.


Compatibility with Git for Enhancing Software Development and Collaboration


Retool's compatibility with Git, a widely used distributed version control system, further enhances its software development and collaboration utility. Git allows multiple developers to work on different project parts simultaneously, merging changes seamlessly. This integration enables teams to leverage Git's branching, merging, and pull request features to manage changes efficiently and maintain high code quality.


Facilitation of Version Control for Applications, Resources, Themes, Queries, and More

Retool provides source control, which allows for version control of different components such as applications, resources, themes, and queries. This feature ensures that all elements of your Retool projects are versioned and can be tracked over time. Teams can quickly revert to previous versions, compare changes, and systematically manage the evolution of their projects.


Importance of Preventing Unauthorized Changes Using Environment Variables

Preventing unauthorized changes is critical in maintaining the integrity and security of your Retool projects. Using environment variables, you can control access and define configurations that should not be modified without proper authorization. Environment variables help manage sensitive information, such as API keys and database credentials, ensuring these details are protected and only accessible to authorized users.


Integrating source control with Retool offers improved collaboration, structured change management, and enhanced security. Supporting various SCM providers and Git compatibility, Retool enables effective project management. Additionally, using environment variables prevents unauthorized changes, making Retool a comprehensive solution for internal tool development and management. For more information, visit Retool's official website and Toolpioneers.


Do you want to explore the Retool source control further? Then, dive into the following section. 


Understanding Source Control Concepts in Retool


Source Control Concepts in Retool

Multi-Element Branching for Simultaneous Editing

Retool's multi-element branching feature allows developers to edit various parts of their projects simultaneously, including apps, modules, and Query Library queries. This will enable teams to work on different sections of an application simultaneously. By creating branches, developers can make isolated changes and merge them into the main project once ready, ensuring a smooth and conflict-free development process.


Toolscript: JSX-Style Markup for Retool App Serialization

Toolscript is Retool’s JSX-style markup language for app serialization. It allows developers to define the structure and behavior of Retool apps clearly and concisely, similar to using JSX in React. This serialization format makes managing and version-controlling Retool apps easier, enabling developers to see changes in a readable format and track modifications over time.


Role of VERSION_CONTROL_LOCKED in Maintaining Secure Edits

The VERSION_CONTROL_LOCKED environment variable plays a crucial role in maintaining the security and integrity of edits within Retool. When enabled, this variable prevents unauthorized changes by locking down critical aspects of the application configuration. It ensures that only authorized users can make modifications, thereby protecting sensitive information and maintaining a stable development environment.


Overview of Git-Based Workflows and Their Importance

Git-based workflows in Retool are essential for managing changes and collaborating on projects. Developers use Git to create branches, make changes, and merge updates in a controlled manner. This process supports pull requests, code reviews, and versioning capabilities for easy rollbacks and tracking changes.


Understanding and leveraging these source control concepts in Retool can significantly enhance your development workflow. Multi-element branching, Toolscript, and VERSION_CONTROL_LOCKED contribute to a secure and efficient environment, while Git-based workflows provide a structured approach to collaboration and version control. 


Now, jump on to the following section and check out the complete details on the Git workflows in Retool 


Git Workflows in Retool


Branching and Version Control in Retool

Implementing Git workflows in Retool is crucial for efficient collaboration and version control in software development. By leveraging Git, teams can manage their codebase and track changes effectively. Understanding the available Git workflows in Retool can streamline your development process and improve your ability to deliver solid and dependable applications.


Choosing a Suitable Git Workflow

Choosing the right Git workflow for your Retool projects depends on the size of your team, their familiarity with Git, and the scalability requirements. Smaller teams or those new to Git may find simpler workflows like the feature branch workflow preferable, as it is straightforward and effective. On the other hand, larger teams with more experience can opt for more complex workflows like Gitflow. Gitflow supports extensive branching and detailed version control, which can enhance scalability and collaboration.


Feature Branch Workflow

The feature branch workflow is the default choice for many teams due to its simplicity and efficiency. Here’s a quick setup and merging process:

Setup:

  • Create a Branch: Create a new branch for each feature or fix from the main branch.


          git checkout -b feature-branch-name


Development:

  • Work on the Branch: Develop and commit changes to this branch.

         

          git add .

git commit -m "Add new feature"


Merging: 

  •  Merge Back: Once the feature is complete, merge it into the main branch.

          

           git checkout main

           git merge feature-branch-name


This workflow ensures the isolated development of features, reduces conflicts, and maintains a stable main branch.


Using Instance Branches with git cherry-pick

Retool recommends using instance branches to manage different environments like development and production. The git cherry-pick command is helpful for selectively merging specific commits between these instances:


Example:

Cherry-Pick a Commit: Apply a commit from the development branch to the production branch

git checkout production

git cherry-pick commit-hash


This method allows precise control over what changes are promoted to production, ensuring stability and reducing the risk of unintended issues.


Ensuring Control Over Deployments with Selective Developer Merge Permissions

To maintain control over deployments and prevent unauthorized changes, it's crucial to implement selective merge permissions. It can be achieved by:

  • Role-Based Access Control (RBAC): Define roles and permissions for who can merge changes into critical branches.

  • Pull Requests: Use pull requests to review and approve changes before merging them. It adds an extra layer of scrutiny and ensures only vetted changes make it to production.


Example Configuration:

  • Development Team: Can create branches and submit pull requests.

  • Lead Developers: Have the authority to review and merge pull requests into the primary or production branches.

This structured approach ensures reviewing all changes and maintaining code quality & stability across deployments.


Implementing the proper Git workflow enhances collaboration, ensures code quality, and maintains stability across environments in Retool. By choosing a suitable workflow and using feature branches with git cherry-pick, teams can seamlessly manage their projects and scale their development processes. For more detailed guidance, visit Retool's official website and Toolpioneers.


In the following section, check out the operational process involved in the Retool source control.


Operational Processes in Retool Source Control

Source control in Retool ensures a structured, collaborative development process using Git workflows. This guide outlines the workflow for changing a protected Retool app and emphasizes configuring source control for cooperative development.


End-to-End Workflow for Making Changes to a Protected Retool App

Step-by-Step Workflow:

  • Create a Branch: Create a new branch from the main branch for your changes. This isolates your work and prevents conflicts with ongoing development.


git checkout -b feature-branch-name


  • Make Changes: Develop and test your changes within this branch. It can include updating queries, modifying UI components, or adding new features.

  • Commit Changes: After making the changes, commit them with descriptive messages to keep track of modifications.


git add .

git commit -m "Added new feature"


  • Push Branch: Push your branch to the remote repository to make it available for collaboration.


git push origin feature-branch-name


Importance of Configuring Source Control for Collaborative Development

Configuring source control in Retool is crucial for several reasons:

  • Collaboration: Multiple team members can work on different features simultaneously without conflicts.

  • Version Tracking: Keep a detailed history of changes, making it easy to revert to previous versions if needed.

  • Code Quality: Through code reviews and pull requests, teams can ensure only quality by merging vetted code into the main branch.

  • Security: Protect critical branches from unauthorized changes, ensuring only approved modifications are deployed.


Steps Involved from Creating a Branch to Deploying Changes

  1. Branch Creation: As outlined above, create a branch from the main branch for your feature or bug fix.

git checkout -b new-feature

  1. Development and Testing: Make necessary changes and thoroughly test them in your local environment.

  2. Commit and Push: Commit your changes and push the branch to the remote repository.

git add .

git commit -m "Implemented new feature"

git push origin new-feature

  1. Create Pull Request: Open a pull request (PR) from your feature branch to the main branch. Other team members will review this PR.

Navigate to your GitHub/GitLab/Bitbucket repository and create a new pull request.

  1. Code Review: Team members review the PR, suggest changes, and approve the merge.

  2. Merge Changes: Once approved, merge the changes into the main branch.

         git checkout main

         git merge new-feature

  1. Deploy: Deploy the updated main branch to production or the relevant environment.


Generating Pull Requests, Reviewing Code, and Merging Changes

  • Generate PR: After pushing your branch, navigate to your SCM provider (GitHub, GitLab, Bitbucket) and create a pull request. Provide a clear description of the changes.

  • Code Review: Team members review the PR, providing feedback and requesting changes if necessary. This step is crucial for maintaining code quality and consistency.

  • Merge Changes: Once the PR is approved, merge the changes into the main branch. It can be done automatically via the SCM provider’s interface or using Git commands.


Example Commands:

# Assuming the PR is approved

git checkout main

git merge new-feature

git push origin main


By following these steps, teams can effectively manage changes from development to deployment, fostering a robust and secure development environment. 

Check out the upcoming section for the practical guide for source control in Retool.


Practical Guide to Using Source Control in Retool


1. Requirements for Setting Up Source Control with GitHub or Other SCM Providers

To set up source control with GitHub or other SCM providers in Retool, you need the following:

  • GitHub Account: Create an account on GitHub or another SCM provider like GitLab or Bitbucket.

  • Retool Account: Ensure you have administrative access in your Retool workspace.

  • Git Installed: Install Git on your local machine if you use command-line operations.


2. Detailed Process for Protecting an App, Creating Branches, and Making Changes

Protecting an App:

  • Navigate to Retool Settings: Go to the settings of your Retool application.

  • Enable Source Control: Enable the integration in the source control section and connect it to your GitHub repository.

  • Protect the App: Mark the app as protected to prevent direct changes in the production environment.

Creating Branches:

  • Create a Branch: From your main branch, create a new branch for the feature or fix you are working on.

git checkout -b feature-branch-name

Making Changes:

  • Develop Locally: Make necessary changes to the app using Retool’s drag-and-drop interface or edit the Toolscript directly.

  • Test Changes: Ensure all changes are tested locally before committing.


3. Committing Changes: Procedures and Best Practices

Committing Changes:

  • Stage Changes: Add the files you have changed to the staging area

         git add .

  •      2. Commit Changes: Commit your changes with a descriptive message.

        git commit -m "Add feature X"

Best Practices:

  • Write Clear Commit Messages: Use concise messages describing the changes made and why.

  • Commit Often: Commit changes frequently to keep track of progress and facilitate easier debugging.


4. Opening and Merging Pull Requests to Finalize Changes

Opening Pull Requests:

  • Push Branch: Push your feature branch to the remote repository

         git push origin feature-branch-name

  • Create Pull Request: Navigate to your repository on GitHub and create a pull request (PR) from your feature branch to the main branch. Provide a detailed description of the changes.

Merging Pull Requests:

  • Review PR: Team members review the pull request, provide feedback, and approve the changes.

  • Merge PR: Once approved, merge the pull request into the main branch using the GitHub interface.

git checkout main

git merge feature-branch-name

git push origin main


5. Removing Application Protection for Maintenance or Updates

Removing Protection:

  • Access Retool Settings: Navigate to the settings of the protected app in Retool.

  • Disable Protection: Temporarily disable the protection to make necessary updates or maintenance changes.

Perform Maintenance:

  • Make Changes: Perform the required updates or maintenance.

  • Re-enable Protection: Once the changes are complete, re-enable the protection to secure the app.


Following the above steps—from setting up source control to managing branches and pull requests—can help you maintain high code quality and secure your applications effectively. 

Check out low-code integration and development platforms for automating application lifestyle with visual modeling tools.


Explore the advanced Retool source control strategies in the following section, which can yield mind-blowing results. 


Advanced Source Control Strategies in Retool


1. Utilization of Releases for Controlling Application Versions and Deployment

Using releases in Retool is a strategic way to control application versions and manage deployments efficiently. By creating releases, you can:

  • Version Control: Tag specific versions of your app to create a snapshot that you can reference or roll back if necessary.

  • Deployment Management: Deploy specific versions of your app to different environments (development, staging, production), ensuring each environment runs the appropriate version.

How to Utilize Releases:

  • Create a Release: Use your SCM provider (e.g., GitHub) to create a release from the desired branch.

         git tag -a v1.0.0 -m "Initial release"

         git push origin v1.0.0

  • Deploy the Release: Configure your CI/CD pipeline to deploy the tagged version to the desired environment.


2. Reverting Changes and Release Management for Maintaining App Integrity

Reverting changes and managing releases are crucial for maintaining app integrity. In case of issues with a new release, reverting to a previous stable version can prevent downtime and ensure stability.

Reverting Changes:

  • Identify the Commit: Find the commit hash of the stable version you want to revert to.

         git log

  • Revert to Previous Commit: Use Git to revert to the identified commit.

        git revert <commit-hash>

Release Management:

  • Rollback Releases: If a new release introduces issues, roll back to the previous release tag.

        git checkout tags/v1.0.0

        git push origin v1.0.0


3. Syncing Changes Across Multiple Retool Instances and Environments

Syncing changes across multiple Retool instances and environments ensures consistency and prevents configuration drift. To manage this, use a combination of Git workflows and environment-specific settings.

Steps for Syncing Changes:

  • Use Environment Branches: Maintain separate branches for different environments (e.g., development, staging, production).

git checkout -b development

git checkout -b staging

git checkout -b production

  • Merge Changes Across Environments: Use pull requests to merge changes from one environment to another, ensuring thorough testing at each stage.

git merge development

git push origin staging

  • Automate Syncing: Implement CI/CD pipelines to automate the deployment process and ensure the synchronization of changes across environments.


4. Preventing Direct Edits on Mission-Critical Apps Through Source Control

Preventing direct edits on mission-critical apps is essential to maintain integrity and security. Source control offers several mechanisms to enforce this:

Strategies to Prevent Direct Edits:

  • Enable Branch Protection: Use branch protection rules to prevent direct pushes to critical branches.

  • On GitHub, navigate to the repository settings, select "Branches," and configure protection rules for main or production branches.

  • Require Pull Requests: Enforce pull request workflows for changes to critical branches, ensuring all changes are reviewed and approved.

  • Set Up Role-Based Access Control (RBAC): Use RBAC to limit who can approve pull requests and merge changes into critical branches.

  • Use Environment Variables: Configure environment variables to control sensitive settings and prevent unauthorized changes.

Example Configuration for Branch Protection:

  • Branch Protection Rule: Status checks are required to pass before merging.

  • Enforce Linear History: Prevent merge commits to ensure a clean commit history.

  • Require Code Reviews: Mandate that at least one reviewer must approve changes.


Utilizing releases for version control, reverting changes to maintain integrity, syncing changes across environments, and preventing direct edits on mission-critical apps are essential for robust application management. These strategies ensure that your Retool applications are well-managed, secure, and always in a deployable state.

If you want to know more about the future directions and best practices for the retool source control, then jump to the next section.


Future Directions and Best Practices for Source Control in Retool


retool source control

Scroll down to check out the plans and best practices. This section will provide you with a deeper understanding.


1. Plans for Expanding Version Control to Other Components Within Retool

Future Directions: Retool continuously evolves to enhance its functionality and user experience. One of the critical areas of focus is expanding version control capabilities to encompass more components within the platform. It includes:

  • Enhanced Component Versioning: Providing granular version control for individual UI components, allowing developers to track changes and roll back specific parts of an application without affecting the entire app.

  • Global Configuration Management: Extend version control to global configurations and settings to track and manage environment-specific configurations systematically.


2. Introduction of App Testing in CI Workflows for Reliability

Best Practices: Integrating app testing into CI workflows is crucial for maintaining application reliability and performance. Here are some recommendations:

  • Automated Testing: Remember to implement automated testing frameworks for unit tests, integration tests, and end-to-end tests. Use tools like Jest, Cypress, or Selenium in the CI pipeline to prevent regression issues with new changes.

  • Continuous Integration: Set up CI pipelines (e.g., GitHub Actions, GitLab CI/CD) to automatically test Retool applications whenever changes are pushed to the repository. It helps catch issues early and maintain high code quality.


Example Workflow:

  • Write Tests: Develop test cases for your Retool applications.

  • Integrate Testing: Add testing steps to your CI configuration file.

name: CI Pipeline


on: [push]


jobs:

  test:

    runs-on: ubuntu-latest


    steps:

    - uses: actions/checkout@v2

    - name: Run Tests

      run: npm test


3. Recommendations for Managing Work-In-Progress Apps and Multi-Instance Deployments

Managing Work-In-Progress Apps:

  • Feature Branches: Use feature branches to manage work-in-progress (WIP) apps. It allows developers to work on new features without affecting the main branch.

  • Draft Pull Requests: Create draft pull requests to facilitate early feedback and collaboration on WIP features.

Multi-Instance Deployments:

  • Environment Branches: Maintain separate branches for different environments (e.g., development, staging, production). It helps isolate changes and ensure that only tested and approved changes reach the production environment.

  • Environment-Specific Configurations: Use environment variables to manage environment-specific settings and configurations. It ensures that each instance is configured correctly according to its environment.

Example Strategy:

  • Branch Strategy: Create and maintain branches for each environment.

git checkout -b staging

git checkout -b production

  • Deploy Strategy: Deploy changes to staging for testing before promoting to production.

git push origin staging

# After testing

git checkout production

git merge staging

git push origin production


4. Tips for Maintaining a Clean and Efficient Remote Repository

Best Practices: Maintaining a clean and efficient remote repository is essential for smooth development workflows and collaboration. Here are some tips:

  • Regular Housekeeping: Regularly clean up old branches that are no longer needed. It prevents clutter and keeps the repository organized.

git branch -d old-feature-branch

git push origin --delete old-feature-branch

  • Use Tags: Use tags to mark specific releases and important milestones. It helps identify stable versions and track progress.

git tag -a v1.0.0 -m "Initial release"

git push origin v1.0.0

  • Commit Hygiene: Write clear and concise commit messages. Squash small, insignificant commits into larger, meaningful ones to keep the commit history clean.

git rebase -i HEAD~4

  • Documentation: Maintain proper documentation for repository structure, branch strategies, and contribution guidelines. This ensures that all team members are aligned and can consistently follow best practices.


Consider implementing advanced source control strategies in Retool to improve development and ensure high-quality, reliable applications. These strategies include expanding version control, integrating app testing in CI workflows, managing WIP apps, and maintaining clean repositories. These practices provide a robust framework for collaborative development and efficient project management.


Are you a beginner in application building? Then Check no-code AI application builders for beginners.


You would have understood much information from the above sections with examples. Now, let’s get you started with Retool source control for your organization via step-by-step guidance in the upcoming section.


Getting Started with Source Control in Retool

Follow up on the steps in this section to get started with your Retool source control journey like a pro!


1. Availability for Enterprise Self-Hosted Plans with Setup Guidance

Retool's source control features are available for Enterprise Self-Hosted plans. This advanced functionality enables organizations to leverage their existing Git workflows to manage Retool applications. To set up source control:

  1. Install Retool on Your Server: Ensure you have the self-hosted version of Retool installed on your server. You can also visit Retool's documentation: Retool Self-Hosted Deployment.

  2. Configure Git Integration: Access the admin settings in Retool and connect your GitHub, GitLab, or Bitbucket account to configure the Git integration.


2. Step-by-Step Guide for Beginners to Integrate Source Control in Retool

Integrating source control in Retool is straightforward. Here’s a step-by-step guide:


Step 1: Enable Source Control

  • Navigate to the admin panel in Retool.

  • Go to the "Source Control" section and enable Git integration.


Step 2: Connect Your Repository

  • Select your SCM provider (GitHub, GitLab, or Bitbucket).

  • Authenticate and connect your repository to Retool.


Step 3: Protect Your App

  • Mark your app as protected to prevent direct edits in production.

  • Configure branch protection rules if necessary.


Step 4: Create and Manage Branches

  • Create a new branch for your feature or fix.

git checkout -b feature-branch

  • Make changes in Retool and commit them to the branch.

git add .

git commit -m "Added new feature"

git push origin feature-branch


Step 5: Open a Pull Request

  • Push your branch to the remote repository and open a pull request for review.

  • Merge the pull request after approval to update the main branch.

For detailed setup instructions, go to https://retool.com/  or contact Toolpioneers for assistance.


3. Contact Information for Demos and Further Inquiries

For demos and further inquiries about integrating source control in Retool, you can contact the Retool team directly:


You can also contact Toolpioneers for the free demo and check out the blogs at https://www.toolpioneers.com/blog for detailed explanations and easy guidance on various mind-blowing topics. Remember, Toolpioneers is the one-stop solution for all your custom apps. Toolpioneers will help you to bring your expectations into reality with professional assistance and expertise in the promised time. So, get started !!

bottom of page