Example Code

Generate a .gitignore File for an Entire Directory Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 

Overview

Given a directory, this VI generates a .gitignore file for all the existing files of that directory.

 

Description

Creating a .gitignore file allows you to then overlay a git repository over that directory ignoring all the files that were there already.

If you get an error running this VI that says you do not have permission to create the file, you will either need to run LabVIEW as an administrator so it has privileges or else create a new text file named “C:\Program Files (x86)\National Instruments\LabVIEW <version>\.gitignore”, and then copy the contents of "file contents" into it.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Open the VI.
  2. Put your path into the path control.
  3. Run the VI.
  4. If you get an error, read the comment on the front panel.

 

Additional Information or References

VI Snippet of Block Diagram

sni.png 

 

 

 **This document has been updated to meet the current required format for the NI Code Exchange. **

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
CharlesB64
Member
Member
on

Why would someone want to generate such a giant gitignore? You can use wildcards to ignore entire directories

AristosQueue (NI)
NI Employee (retired)
on

Because you have a system under which the files managed by git are going to be scattered throughout an existing files structure, where the sync is going to pull down into a non-empty directory. Why would you do this? Because you're trying to port a system developed for Perforce or other SCC systems that allow (and to some degree encourage) such overlaying into git. Not at all the recommended way of working with git. The VI was needed and this was the best place I could put it to make it available to everyone who needed it.