Create versions and branches in Git

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:5分
  • App developers using ServiceNow Studio can create versions and branches in their Git repositories.

    Switch repository branches

    Application developers can switch to a different repository branch to work on another version of the application using ServiceNow Studio.

    始める前に

    You must have a Git repository with one or more available branches.

    Role required: admin

    手順

    1. Navigate to All > App Engine > ServiceNow Studio.
    2. In the file navigator, select the application you want to open.
    3. Select App details to open the app in the canvas.
    4. Select Source control > Switch branch.
    5. Choose whether you want to stash or discard local changes.
      OptionDescription
      Stash local changes Saves local changes before switching to an alternate branch. You can later merge or discard the saved changes.
      Discard local changes Permanently deletes all local changes before switching to an alternate branch. If you choose to discard, you will not be able to recover those files.
      注:
      Use caution when discarding local changes. Since all application developers share repository credentials, there is no way to discard just one set of user changes.
    6. Select the branch you want to switch to.
    7. Select Switch Branch.

    タスクの結果

    ServiceNow Studio updates the local application to match the branch version from repository.

    Create a repository branch

    Application developers can create a branch to work on a new version of an existing app in ServiceNow Studio. Creating a branch will result in a new branch being created in the remote repository that is configured for this application. This application, including any uncommitted changes, will switch to the new branch.

    始める前に

    Role required: admin or sn_group_creator.app_creator

    手順

    1. Navigate to All > App Engine > ServiceNow Studio.
    2. In the file navigator, select the application you want to open.
    3. Select App details to open the app in the canvas.
    4. Select Source control > Create branch.
    5. Enter a Branch name.
    6. オプション: Create a branch from a tab by selecting the Create from Tag drop-down list and selecting an existing tag.
    7. Select Create Branch.
    8. Select Close.

    Set a default branch

    Set a default branch when you want to use a branch other than main for new changes or for your main ServiceNow Studio development repository.

    始める前に

    Link an app to source control in ServiceNow Studio

    Role required: admin

    手順

    1. Follow the steps listed in Add a system property.
    2. Add the glide.source_control.default_branch_name property, and specify the default branch name of the Git source control repository to work from.
      For example, default branch names could include pull requests, code commits, and the like. Application developers' work is managed from and saved into the default branch if not otherwise specified. If not changed, this value defaults to sn_instances/<instance_name>.