Skip to content

Instantly share code, notes, and snippets.

@tmatijevich
Last active February 2, 2024 21:10
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmatijevich/453436f1e6abc62a3d052d9b03f9db58 to your computer and use it in GitHub Desktop.
Save tmatijevich/453436f1e6abc62a3d052d9b03f9db58 to your computer and use it in GitHub Desktop.
Automation Studio Project gitignore

Automation Studio Project gitignore

Use a gitignore file when managing an Automation Studio project with git on Windows.

Create the gitignore file on Windows

  1. Open File Explorer
  2. Under the View tab, check File name extensions
  3. Navigate to the project directory
  4. Right click in the blank space and select New -> Text Document
  5. Rename the text file (including the extension) New Text Document.txt to .gitignore.
    • Append a second period if Windows blocks direct creation of a blank file name
  6. Acknowledge the prompt to change the file extension
  7. Your file should now appear as .gitignore

Write the gitignore file

  1. Open the .gitignore file with a text editor, such as Notepad(++)
  2. Copy the contents below to the file

The following ignore filters are specific to Automation Studio projects. Place the ignore file parallel to the project (.apj) file.

# Ignore files in Automation Studio projects
# Place gitignore file parallel to project (*.apj) file
# More information at https://git-scm.com/docs/gitignore

# Ignore AS system files
/AS/System
# Ignore entire Binaries directory relative to gitignore
/Binaries
# Ignore everything inside Diagnosis directory
/Diagnosis/**
# Make exception for subdirectories (credit https://stackoverflow.com/a/41112097)
!/Diagnosis/**/
# Ignore temporary safety files
/Physical/*/*/*/DLFiles
# Ignore Temp directory
/Temp
# Ignore upgrade files
/Upgrades

# Ignore user set and isopen files
/*.set
/*.isopen

# Ignore project archives
/*.zip

# Ignore logs
/debug.log
/ConvertLog.txt

# Exception for watch and trace configurations
# Uncomment to use
#!/Diagnosis/**/*.PVM
#!/Diagnosis/**/*.tc

git status and git add will now adhere to the ignore filter rules. Note: Files already in the index are unaffected by the ignore filter (the ignore filter only applies to untracked files).

Additional Automation Studio gitignore files

Update gitignore and remove tracked files

Changes to ignore patterns have no effect on tracked files. With additional git commands, it is possible to apply updated ignore patterns. Follow these steps to remove tracked files that match the ignore patterns. Use git reset at any point to return the index back to the most recent commit.

  1. git rm -fr --cached .
    • git rm removes files from the working tree and/or index
    • -f force
    • -r recursively through directories
    • --cached only remove files from the index, leave working tree alone
    • . all files
    • Use git rm -fnr --cached . to perform a dry-run (-n)
  2. git add .
    • Adds contents of all files (except ignored) to the index
    • Use git add -n . for dry-run
  3. Commit
    • Steps 1 & 2 update the index, use git status to confirm newly ignored files are removed

Original solution from stack overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment