From 32fa1a369b9e084151064d1ea18ac7245964c45d Mon Sep 17 00:00:00 2001 From: Sarthak Jain Date: Sun, 15 Mar 2026 14:10:52 +0530 Subject: [PATCH] Fix stow --- .stow-local-ignore | 4 +-- README.md | 56 +++++++++++++++++++++++--------------- scripts/.stow-local-ignore | 1 + shell/.stow-local-ignore | 1 + shell/work | 0 5 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 scripts/.stow-local-ignore create mode 100644 shell/.stow-local-ignore create mode 100644 shell/work diff --git a/.stow-local-ignore b/.stow-local-ignore index 0c3072c..81331f2 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -28,5 +28,5 @@ _darcs scripts # scripts directory to be ignored shell # various shell configurations need not be stowed. .DS_store -README.md -.*/\.git +README.md +.*/\.git diff --git a/README.md b/README.md index 239a6e6..130e02e 100644 --- a/README.md +++ b/README.md @@ -39,44 +39,56 @@ sudo pacman -S stow To install all configurations at once, navigate to the root of this repository and run: ```bash -stow . +stow */ ``` +*(Note: Using `stow */` prevents the shell from passing pure files like `README.md` to Stow, ensuring only directory packages are stowed).* -This will automatically create the necessary symlinks in your `$HOME` directory pointing to the files in this repository. +This will automatically create the necessary symlinks in your `$HOME` directory. ### Removing Configurations If you want to remove the symlinks created by Stow, use the `-D` flag: ```bash -stow -D . +stow -D */ ``` -## Directory Structure +## Directory Structure & Branching Strategy -The folder structure directly mirrors its target destination relative to the home (`~/`) directory. +This repository uses a **Folder-Per-App** structure combined with a **Git Branching Strategy** to flawlessly handle different machines (Mac, Work, Linux) without any `if/else` logic. + +### 1. Folder Structure +The root directories represent individual applications: ```text . -├── .bashrc # Symlinked to ~/.bashrc -├── .config/ # Symlinked to ~/.config/ -│ ├── alacritty/ -│ ├── kitty/ -│ ├── nvim/ -│ ├── starship.toml -│ └── ... -├── .fonts/ # Symlinked to ~/.fonts/ -├── .tmux.conf # Symlinked to ~/.tmux.conf -├── .tmux.conf.local # Symlinked to ~/.tmux.conf.local -├── .vimrc # Symlinked to ~/.vimrc -├── .zshrc # Symlinked to ~/.zshrc -├── scripts/ # Symlinked to ~/scripts/ -├── shell/ # Symlinked to ~/shell/ -└── wezterm.lua # Symlinked to ~/wezterm.lua +├── bash/ # Stowed to ~ (contains .bashrc) +├── nvim/ # Stowed to ~/.config/nvim/ +├── tmux/ # Stowed to ~ (contains .tmux.conf) +├── zsh/ # Stowed to ~ (contains .zshrc) +└── ... ``` +### 2. The Git Branch Workflow +This repository has zero conditional logic. Configurations are managed purely via branches. + +- **`master` branch**: Contains the 95% common base configurations shared across all machines. +- **`mac`, `work`, `linux` branches**: Machine-specific branches derived from `master`. + +**How to manage machine-specific settings:** +1. Check out your machine's branch (e.g., `git checkout work`). +2. Statically write your overrides (e.g., adding a Work-only plugin to `nvim/`). +3. Commit and push: `git push origin work`. + +**How to update shared settings:** +1. Switch to the base branch: `git checkout master`. +2. Update the shared configuration and commit. +3. Switch back to your local branch: `git checkout work`. +4. Pull the updates in by rebasing: `git rebase master` (then `git push origin work -f`). + ### Adding New Configurations When you want to add a new tool: -1. Replicate the target directory structure inside this repository (e.g., `.config/new_tool/config.toml`). -2. Run `stow .` from the root of this repository to link the new files. +1. Create a new folder matching the application's name (e.g., `mkdir alacritty`). +2. Replicate the target directory structure inside it (e.g., `alacritty/.config/alacritty/alacritty.toml`). +3. Run `stow */` from the root of this repository to link the new package. diff --git a/scripts/.stow-local-ignore b/scripts/.stow-local-ignore new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/scripts/.stow-local-ignore @@ -0,0 +1 @@ +.* diff --git a/shell/.stow-local-ignore b/shell/.stow-local-ignore new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/shell/.stow-local-ignore @@ -0,0 +1 @@ +.* diff --git a/shell/work b/shell/work new file mode 100644 index 0000000..e69de29