Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataform .gitignore not working

In a standard initialized dataform workspace, I have a .gitignore file. I want to utilize it to exclude files from syncing with the connected Bitbucket repository. However, when I add "dataform.json" to the .gitignore file (they are both at the root file level), it still detects changes to that file and tries to include them in commits. Same if I add a folder/ or file such as "definitions/file1 ".

How do I get .gitignore to take effect and actually ignore certain files from VC?

Solved Solved
0 2 271
1 ACCEPTED SOLUTION

The disconnect was not with Dataform, it was Git caching files.

Git ignores only untracked files. Once you add a file it cannot be ignored. If you want this file to be ignored you have to unstage it:

git rm --cached <file>

Look at this answer for more. 

View solution in original post

2 REPLIES 2

Same here. No matter what files I inlude in there, they all get uploaded to the external Git provider.

The disconnect was not with Dataform, it was Git caching files.

Git ignores only untracked files. Once you add a file it cannot be ignored. If you want this file to be ignored you have to unstage it:

git rm --cached <file>

Look at this answer for more.