Tracking home assistant configuration in git. What to track? "

For a long time I have in my ToDo list the task to start tracking the changes I do in GA configurations to easily revert a change I did and broke something.

Now qiht the inclusion of LLM agents, I think is more important than ever, BUT now that I wanted to do it, I realized I have no idea what to track besides “configuration.yaml” or “automations.yaml”.

Is any of you tracking your changes with git? What do you exclude or include? (Besides excluding secrets.yaml of course :sweat_smile:

Thanks in advance for the answers!

This has a lot to do with how you do things, but I have everything split up, and only a few transient items in the UI YAML files…

A good gitignore starts out by ignoring everything, and letting in only the stuff that you let in. That eliminates a lot of the common mistakes. In addition (after failsafe) I add at the end things that I double never want to share, so things like secrets and most of .storage are ignored twice in case of a fumble finger somewhere.

## Ignore all
*
**

## Allow folders
# !*/
!/automation2/
!/automation2/*.yaml
!/automationDev/
!/automationDev/*.yaml
!/blueprints/
!/blueprints/**
!/blueprints/*.yaml
!/command_line/
!/command_line/**
!/command_line*.yaml
!/custom_templates/
!/custom_templates/*.jinja
!/esphome
!/esphome/packages
!/esphome/*.yaml
!/esphome/packages/*.yaml
!/light/
!/light/*.yaml
!/mp3/
!/mp3/**
!/mqtt/
!/mqtt/**
!/mqtt/*.yaml
!/packages/
!/packages/*.yaml
!/python_scripts/
!/python_scripts/*.py
!/script2/
!/script2/*.yaml
!/switch2/
!/switch2/*.yaml
!/sensor2/
!/sensor2/*.yaml
!/scriptshell/
!/scriptshell/blueprints_update.sh
!/templates/
!/templates/**
!/templates/*.yaml
!/zigbee2mqtt/
!/.github*
!/.github/FUNDING.yml
!/.storage/
!/.storage/broadlink_remote_*_codes
!/.storage/image
!/.storage/input_*
!/.storage/lovelace*

## Allow files
!alert.yaml
!automations.yaml
!binary_sensors.yaml
!button.yaml
!camera.yaml
!climate.yaml
!cloud.yaml
!compensation.yaml
!configuration.yaml
!counter.yaml
!cover.yaml
!customize.yaml
!fan.yaml
!ffmpeg.yaml
!frontend.yaml
!google.yaml
!groups.yaml
!hacs.yaml
!humidifer.yaml
!life360.yaml
!light_profiles.csv
!history.yaml
!homeassistant.yaml
!lock.yaml
!logger.yaml
!media.yaml
!media_player.yaml
!mqtt.yaml
!notify.yaml
!octoprint.yaml
!panel_custom.yaml
!panel_iframe.yaml
!person.yaml
!plant_status.yaml
!recorder.yaml
!rest_command.yaml
!ring.yaml
!scene.yaml
!scripts.yaml
!sensors.yaml
!sonoff.yaml
!switch.yaml
!timer.yaml
!tts.yaml
!updater.yaml
!zones.yaml
!.HA_VERSION
!.gitkeep
!README.md
!LICENSE

############# Failsafe  \/ \/ \/ \/ \/ #############

# File Ignores
home-assistant.log.*
remote_cmd.yaml
/script2/lock_script_secret.yaml
**secrets.yaml
shell_command.yaml
**/test.yaml
/zigbee2mqtt/*.yaml

.git-credentials

# Generic ignores
*.log
*.db
*.db-shm
*.db-wal
*.pyc
._*
__pycache__

# Directory (contents) ignores
/blueprints/automation/test**
/blueprints/script/test**
/Purgatory**
/scripts/
/themes**
/www**
/.storage/auth**
/.storage/cloud**
/.storage/core**
/.storage/hacs**
/.storage/http
*/deps**
*/image**
*/pop.git**
*test**

# Ignore files created by IDE's
*&/.vscode**
*/.theia**
*/.Trash**

1 Like

Wow this really detailed, thanks!

1 Like