Any tips and tricks for using #git for #nix #nixos #flakes : when the "mother flake" flake lives on a public repo & is set up to provide multiple #configurations for different machines built using:
nixos-rebuild switch --flake .#<machine_name>
I dug myself into a hole by copying the files from the mother flake repo to set up a new machine and the flake on my new machine has diverged & cannot be merged back into the mother flake repo because I did not *clone* it down so has no common git history
@adingbatponder in the future you could try writing the changes in the flake and deploying the new host from an existing host. e.g. with nixos-anywhere and deploy-rs. That way you don't need your flake on the new host.
@adingbatponder this sounds like it hasn't actually diverged in a semantic sense, or am I misinterpreting? If that is the case just export a commit series (perhaps even by creating a new git repo) as a patch, apply them to the mother repo and then clone out the patched mother repo

@edwtjo
Thanks I think you have solved it.

1. git clone repo → local_machine/flake-new
2. Create local_machine branch from repo main
3. Copy local_machine/flake flake features or files from local_machine/flake into a local_machine/flake-new
4. Commit and push local_machine branch to repo
5. Merge branch on repo
6. Rename local_machine/flake → flake-old, and rename local_machine/flake-new → flake
7. Future pushes from local_machine/flake now share repo's history

@adingbatponder @edwtjo sounds like the way better solution for now. In principle one _can_ also have multiple initial commits and merge the trees later on. But thats definetly adavanced git sourcery ^^

@stadtkind @edwtjo Well I really got into a spin. When doing the above where you
1. pull a new flake down into a directory with a new name /flake-new
2. rename the old /flake directory /flake-old
3. rename /flake-new as /flake and check this out as branch
4. try nixos-rebuild switch --flake .#<machine_name>

caused the rebuild command not to switch. It just kept giving me the old generation...because I was doing 4. from previous main but should be done from the new branch #nixos #flake #git

@stadtkind @edwtjo  The trick is to open a new terminal window and then build and switch... because then the directory /flake is on its branch ..... 
@stadtkind @edwtjo Thanks for the input. FYI this is my playbook for this #git #nixos #flake synch / reconciliation process when two flakes have deviated and you want to make them the same by using a repo, e.g. codeberg , as the single source of truth. The solution uses the branch main on the main computer which has the main flake that should be up to date always, & a branch on the other machine named after the machine. The other machine will always commit to its branch https://codeberg.org/adingbatponder/reticulum_nixos_flake/src/branch/main/docs/git-flake-reconciliation.md
reticulum_nixos_flake/docs/git-flake-reconciliation.md at main

reticulum_nixos_flake - Installing reticulum messaging and site tools MeshChat and Nomadnet using NixOS flake

Codeberg.org