Use a gitignore file when managing an Automation Studio project with git on Windows.
- Create the gitignore file
- Write the gitignore file
- Additional Automation Studio gitignore files
- Update gitignore and remove tracked files
- Open File Explorer
- Under the View tab, check File name extensions
- Navigate to the project directory
- Right click in the blank space and select New -> Text Document
- 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
- Acknowledge the prompt to change the file extension
- Your file should now appear as
.gitignore
- Open the
.gitignore
file with a text editor, such as Notepad(++) - 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).
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.
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
)
git add .
- Adds contents of all files (except ignored) to the index
- Use
git add -n .
for dry-run
- Commit
- Steps 1 & 2 update the index, use
git status
to confirm newly ignored files are removed
- Steps 1 & 2 update the index, use
Original solution from stack overflow.