Skip to content

Git Client

Git Client is used by scripting services to call git commands

  • Module: git/client
  • Source: /git/client.js
  • Status: stable
  • Group: platform

Basic Usage

import { client } from "sdk/git"

const user = "dirigible";
const email = "";
const workspaceName = "workspace";
const projectName = "project";
const repositoryName = projectName;
const initialCommitMessage = "Initial commit";
const commitMessage = "Second commit";
const add = true;

client.initRepository(user, email, workspaceName, projectName, repositoryName, initialCommitMessage);

client.commit(user, email, workspaceName, repositoryName, commitMessage, add);


Function Description Returns
initRepository(user, email, workspaceName, projectName, repositoryName, commitMessage) Initializes a repository in the selected project -
commit(user, userEmail, workspaceName, repositoryName, commitMessage, add) Creates a new commit in the selected project repository -
getGitRepositories(workspaceName) Returns all git repositories in the selected workspace Projects
getHistory(repositoryName, workspaceName, path) Returns git history for the selected repository GitCommitInfoList
deleteRepository(workspaceName, repositoryName) Deletes git repository -
cloneRepository(workspaceName, repositoryUri, username, password, branch) Clones repository from given URL in selected workspace -
pull(workspaceName, repositoryName, username, password) Pull current branch of selected repository -
push(workspaceName, repositoryName, username, password) Push current branch to origin -
checkout(workspaceName, repositoryName, branchName) Checkout given branch -
createBranch(workspaceName, repositoryName, branchName, startingPoint) Creates a new branch -
hardReset(workspaceName, repositoryName) Hard reset current branch -
rebase(workspaceName, repositoryName, branchName) Rebase selected branch -
status(workspaceName, repositoryName) Get selected repository status Status
getBranch(workspaceName, repositoryName) Get current branch String
getLocalBranches(workspaceName, repositoryName) Get list of local branches Branches
getRemoteBranches(workspaceName, repositoryName) Get list of remote branches Branches
getUnstagedChanges(workspaceName, repositoryName) Get unstaged changes for selected repository GitChangedFiles
getStagedChanges(workspaceName, repositoryName) Get staged changes for selected repository GitChangedFiles
getFileContent(workspaceName, repositoryName, filePath, revStr) Get the content of selected file String



Function Description Returns
size() Returns the size of this GitCommitInfoList programmatically integer
get(index) Gets a GitCommitInfo by index programmatically GitCommitInfo


Function Description Returns
getId() Gets the id of the commit string
getAuthor() Gets the author of the commit string
getEmailAddress() Gets the author's email address string
getDateTime() Gets the date and time of the commit string
getMessage() Gets the commit's message string


Function Description Returns
isClean() Checks whether the repository is clean boolean
getAdded() Gets added files array of strings
getChanged() Gets changed files array of strings
getRemoved() Gets removed files array of strings
getMissing() Gets missing files array of strings
getUntracked() Gets untracked files array of strings
getUntrackedFolders() Gets untracked folders array of strings
getConflicting() Gets conflicting files array of strings
getIgnoredNotInIndex() Get ignored files array of strings
getUncommittedChanges() Get uncommited changes array of strings


Function Description Returns
size() Returns the size of this Branches list programmatically integer
get(index) Gets a Branch by index programmatically Branch


Function Description Returns
getName() Gets the name of the branch string
isRemote() Checks whether the branch is remote boolean
isCurrent Checks whether the branch is current boolean
getCommitObjectId() Gets the commit's object id string
getCommitShortId() Gets the commit's short id string
getCommitDate() Gets the commit's data string
getCommitMessage() Gets the commit's message string
getCommitAuthor Gets the commit's author name string


Function Description Returns
size() Returns the size of this GitChangedFiles list programmatically integer
get(index) Gets a GitChangedFile by index programmatically GitChangedFile


Function Description Returns
getPath() Gets the path of the changed file string