Working with Git in the Editors

Updated Sep 13, 2026
DataMagik Automate

Working with Git in the Editors

Match an item to a file once; after that it is check, pull, commit.

The git panel appears in the SQL Editor and the Script Engine editor, as a Git button in the toolbar at the top right, near Save.

Not seeing the Git button? It only appears once your company has at least one repository connection — the editor checks when the page loads, so add the connection first and then reload the editor. Setup lives on your profile: Settings → Git Access Tokens. See Setting Up a Git Connection.

Matching an item to a file

Save the query or script first — an unsaved item has nothing to link, and the panel will say so. Then use the Git button and work through four choices, in the order you would make them:

  1. Which repository — if your company has more than one connection.
  2. Which branch — the connection's default branch is offered, and you can switch or create one here.
  3. Which folder — browse the repository rather than typing a path. Click into folders; use the up control to go back.
  4. Which file — pick an existing file to adopt it, or type a new name to create it. The suggested name comes from the connection's path setting.

That link is remembered, so the panel opens straight to status next time.

Checking status

Status is the panel's resting state. It names the branch and the path — always both, because "up to date" means nothing if you do not know which branch you are up to date with. You will see one of:

  • Up to date with branch — what is saved here matches the file.
  • Differs from what is saved here — the two have drifted apart. Pull to see the repository's version, or commit to publish yours.
  • Does not exist on branch yet — committing will create it — the file is new to the repository.

Pulling

Pull reads the file and shows you what the repository holds. It never writes into the editor by itself. You are asked before anything replaces what is open, because taking away unsaved work without asking is the one thing a pull must not do. If you accept, the text is placed in the editor — and you still have to save it in DataMagik for it to stick.

Committing

Enter a commit message in the panel and confirm. Two details matter:

  • The saved version is committed, not the editor buffer. If you have unsaved edits, save them first — otherwise you commit what DataMagik has, not what is on your screen. This is deliberate: a change committed to your repository that cannot be found in DataMagik afterwards is worse than an extra click.
  • Committing twice with no change is not an error. You are told there was no change and nothing is written.

If someone else changed the file

Every commit carries a fingerprint of the file as DataMagik last read it. If the file moved in the repository since then, the commit is refused and nothing is written — you are told the file changed and asked to review. DataMagik never merges on your behalf. Pull, look at the difference, decide, then commit again.

If a commit times out, check before retrying. Press status once. A retry that finds the file already holding exactly your content will tell you an earlier attempt landed and nothing more was committed — rather than blaming a colleague for a change that was yours.

Branches

Switch branches from the panel, or create one from the branch you are on. The branch you choose is remembered as your working branch for that repository — it is stored per person, so changing it does not change what a colleague sees. Committing to a feature branch and opening a pull request is the normal shape of this; committing straight to a shared default branch works too, if that is how your team operates.

Pull requests

Once you have committed to a branch, Open pull request raises one at your git host, from your working branch into the connection's default branch. The panel links to it. If one is already open for that branch, you are told that rather than shown an error. Merging and reviewing happen at the host, as usual — DataMagik does not merge.

Scripts carry their settings

A script's file starts with a header block, then the code:

/* @dm-script
   name: Nightly AR Export
   description: Builds the AR aging file and emails it
   category: Finance
   active: true
   timeoutSeconds: 900
*/
function main(context) {
  // ...
}

That header is why a script restored from git comes back configured rather than as bare code — its name, description, category, tags, timeout, credentials and allowed domains travel with it. It is also plain JavaScript comment syntax, so the file stays readable and runnable-looking in any editor. Leave the block in place when editing the file outside DataMagik; a file committed unchanged produces no diff.

How long things take

Each operation fetches what it needs from your git host, so expect a few seconds rather than instant. Several people can work at once. If nothing is processing git work, you are told so immediately — you will not sit watching a spinner for a minute and a half to find out.

Next steps

Was this page helpful?