google-cloud-platformgoogle-bigquerydataform

.gitignore not working in Dataform repository


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?


Solution

  • 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.