Using source control in the ServiceNow IDE
Summarize
Summary of Using source control in the ServiceNow IDE
The ServiceNow Integrated Development Environment (IDE) supports Git source control to help development teams manage application changes efficiently. Users with admin roles can leverage built-in Git commands within the IDE to perform key version control operations without leaving the platform.
Show less
Key Features
- Git Command Integration: The IDE provides direct access to essential Git commands such as checkout, clone, commit, create branch, discard changes, fetch, pull, push, stage, and stash through the Source Control view or command palette.
- Branch Management: Users can check out branches, create new branches, and manage branches within the IDE. Only one branch per repository can be checked out on an instance or developer sandbox at a time.
- Commit History and Diff Viewing: Commit history is accessible within the Source Control view, showing detailed commit information. File-specific commit histories and change diffs can be viewed via the File Explorer timeline and Diff editor.
- Merge Conflict Resolution: When conflicts occur between local and remote changes, they are highlighted in the Source Control view. Developers can resolve conflicts by accepting changes or manually editing the file within the IDE.
- Stashing Changes: Uncommitted changes can be stashed and reapplied later using the stash commands available in the IDE, facilitating flexible workflows.
- Repository Management: Users can update the remote repository URL connected to an application directly from the IDE using the "Git: Update remote origin" command.
Practical Benefits for ServiceNow Customers
- Streamlines version control workflows by integrating Git capabilities directly into the ServiceNow development environment.
- Enables collaborative application development with branch management and conflict resolution tools tailored for ServiceNow instances.
- Enhances tracking and auditing of application changes through commit histories and diff comparisons.
- Supports flexible development workflows by allowing stashing and staged commits, minimizing disruption during ongoing work.
- Facilitates easy onboarding of existing Git repositories and connections to Git providers via OAuth 2.0 or basic authentication.
Use Git commands and other source control features in the ServiceNow IDE to manage changes to an application across a development team.
Role required: admin
Git commands
After initializing a local Git repository in the ServiceNow IDE, you can perform several Git commands from the Source Control view () or command palette, including but not limited to the following commands.
| Command | Description |
|---|---|
| Checkout to ( Command palette: Git: Checkout to... |
Check out another branch from the repository. Select the branch from the list or create a branch and push it to the remote repository. Only one branch per repository can be checked out at a time on an instance (or developer sandbox). |
| Clone ( Command palette: Git: Clone |
Clone a remote repository to add an application to your workspace. For more information, see Clone a Git repository with the ServiceNow IDE. |
| Commit ( Command palette: Git: Commit |
Commit your staged changes to the local repository. Enter a commit message to describe your changes. |
| Create branch ( Command palette: Git: Create branch... |
Add a branch to a repository and check it out. |
| Discard ( Command palette: Git: Discard Changes |
Discard changes to undo modifications to an application. |
| Fetch ( Command palette: Git: Fetch |
Fetch to sync commits and branches from the remote repository into the local repository. |
| Pull ( Command palette: Git: Pull |
Pull to merge the latest changes from the remote repository into the local repository. |
| Push ( Command palette: Git: Push |
Push your committed changes to the remote repository. |
| Stage ( Command palette: Git: Stage Changes |
Stage the changes in your working directory that you want to commit. When you stage changes, files move from the Changes list to the Staged Changes list. |
| Stash ( Command palette: Git: Stash, Git: Pop, Git: Drop, Git: List, Git: Apply, Git: Clear |
Stash all uncommitted changes to save them in your working directory locally and come back to them later. The pop, drop, list, apply, and clear subcommands are supported when stashing. Select to reapply your changes in your working directory. |
Merge conflicts
If there’s a conflict between local and remote changes in a file, the file is listed under Merge conflicts in the Source Control view (). You can review conflicts in the editor and resolve them by accepting the current or incoming change, both, or manually editing the file.
Commit history
The commit history for a branch is listed in the Commits section of the Source Control view () and includes details about the commits. To see the commit history for a file, navigate to the File Explorer view (
), select the file, and expand the Timeline section. When you select a commit, a Diff editor comparing the changes opens.
Repository changes
To update the remote repository an application is connected to, you can use the Git: Update remote origin command from the command palette and enter a different remote repository URL.