# Which files need version control?

**URL:** <https://discourse.nodered.org/t/which-files-need-version-control/33201>\
**Category:** General\
**Created:** [23 September 2020 00:02 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201 "2020-09-23T00:02:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [23 September 2020 00:02 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/1 "2020-09-23T00:02:40Z")

</div>

I found only one topic that's close to my question but it's old and I'd rather not necro-bump.

I have a local Subversion server that I want to use for versioning my changes/additions to my work. I read about Projects but it doesn't seem to handle my case. So, what I need to know is the list of files that I need to put in my repository to save me from myself. I'm not going to put the entire ~/.node-red tree in there, just whatever holds my flows... and settings.js

You're assistance is appreciated.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 September 2020 00:56 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/2 "2020-09-23T00:56:12Z")

</div>

You should check in everything except the `node_modules` folder.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [23 September 2020 01:25 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/3 "2020-09-23T01:25:50Z")

</div>

Thanks, @TotallyInformation

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [23 September 2020 05:13 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/4 "2020-09-23T05:13:37Z")

</div>

I'd also leave out the files beginning with a dot, especially the backup files.

And I recommend setting ` flowFilePretty: true,` in your settings.js, so you can track flow file changes by line.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 September 2020 08:18 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/5 "2020-09-23T08:18:21Z")

</div>

In addition to setting flowFilePretty, before committing I run this script which generates a formatted version of the flows file (with the extension `.formatted`) which has function nodes formatted one line per line of source (rather than the function being all on one line). This allows diffs to be viewed which show line by line changes to function nodes. The formatted file has to be committed too of course. The formatted file cannot be used as the actual flows file, it is just for viewing diffs.

```auto
#!/usr/bin/env sh

# generates formatted versions of node red flow files matching flow*.json
# in files flow*.json.formatted

# NOTE must have flowFilePretty: true in settings.js

for f in flow*.json; do
  echo $f
  sed -r 's/\\n/\n/g' "$f" > "$f.formatted"
done
# remove any cred files converted
rm *_cred.json.formatted

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 September 2020 09:33 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/6 "2020-09-23T09:33:07Z")

</div>

> [@kuema](#):
>
> files beginning with a dot, especially the backup files

Actually, I would want those in version control personally.

> [@kuema](#):
>
> flowFilePretty: true

Yes, that certainly will allow git to do a better job of diff'ing the changes.

> [@Colin](#):
>
> I run this script which generates a formatted version of the flows file

Cool.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [28 September 2020 21:14 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/7 "2020-09-28T21:14:08Z")

</div>

> [@kuema](#):
>
> I'd also leave out the files beginning with a dot,

Yep...except for one.

> [@Colin](#):
>
> this script

Sweet! Thanks

> [@TotallyInformation](#):
>
> will allow git

Probably good advice but...

> [@LosinIt](#):
>
> I have a local Subversion server

Here is the list that serves my needs:

- .config.json
- flows\_pvr.json
- flows\_pvr\_cred.json
- nodejs-node-red
- package-lock.json
- package.json
- settings.js

My thanks to all!

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [29 September 2020 04:34 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/8 "2020-09-29T04:34:09Z")

</div>

I left out the .config.json since early versions of Node-RED because it doesn't contain anything useful in _my_ setups. The node list is regenerated at start, I don't use projects and my credentials key is in the settings.js. So besides the user settings for the editor, there's nothing I would want in Git.

However, there's an interesting change coming: [Split .config.json into separate files](https://github.com/node-red/node-red/pull/2704)  
So you will have better control over what goes into Git in the future. 😀

> [@TotallyInformation](#):
>
> Actually, I would want those in version control personally.

For curiosity's sake, why would want the \*.backup files in Git, too? Or did you just mean the .config.json?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 September 2020 08:37 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/9 "2020-09-29T08:37:25Z")

</div>

> [@LosinIt](#):
>
> nodejs-node-red

What is that file?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [29 September 2020 08:48 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/10 "2020-09-29T08:48:33Z")

</div>

> [@kuema](#):
>
> For curiosity's sake, why would want the \*.backup files in Git, too? Or did you just mean the .config.json?

Well, if you have arranged something so that you auto-commit on every change AND gave users the ability to undo changes via git, you wouldn't need it. Otherwise, the backup files are your users get-out-of-jail-free card in case they make a booboo or in case there is a write error when Node-RED updates the file (something that is improved in the next release).

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [30 September 2020 16:23 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/11 "2020-09-30T16:23:02Z")

</div>

Just these 2 lines  
NODE\_OPTIONS=""  
NODE\_RED\_OPTIONS=""

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 September 2020 18:28 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/12 "2020-09-30T18:28:08Z")

</div>

I meant where did it come from and what is it for? I don't think it is part of the standard set of files, unless it is a Windows thing that I don't know about.

Do many still use SVN? I switched to git about 12 years ago I think.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [30 September 2020 18:36 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/13 "2020-09-30T18:36:33Z")

</div>

> [@Colin](#):
>
> where did it come from

I think I copied it when I setup NR to run under my username. It's been a while so I'm not sure why.

> [@Colin](#):
>
> Windows

Not in my network!!!

> [@Colin](#):
>
> Do many still use SVN?

I haven't any idea. I set it up at home because that's what we used at work 15 years ago and I have no need or desire to change.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 September 2020 19:15 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/14 "2020-09-30T19:15:07Z")

</div>

> [@Colin](#):
>
> Do many still use SVN

Not many 🙂 Too many advantages to git.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 October 2020 19:15 UTC](https://discourse.nodered.org/t/which-files-need-version-control/33201/15 "2020-10-14T19:15:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
