Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

understanding gnu stow #14

Closed
ElModdy opened this issue Apr 15, 2019 · 1 comment
Closed

understanding gnu stow #14

ElModdy opened this issue Apr 15, 2019 · 1 comment
Assignees

Comments

@ElModdy
Copy link

ElModdy commented Apr 15, 2019

Hi,
I'm new to Stow and I'm having difficulties understanding how to manage the dotfiles properly.
My quest is: If you have to add a file, do you create it in the repo and then relaunch stow every time?
I know my question is off topic and I will remove it if you don't want to answare me but I really appreciate any kind of help.

@xero
Copy link
Owner

xero commented Apr 16, 2019

hey, no worries.

stow is an on demand tool. when you run the command it looks in the specified directory for files then symlinks them into the target location. if you edit one of the source files already linked the changes are immediate. but if you create a new file the symlinks are not created yet until you run stow (again).

hope that helps! i wrote a blog post about my workflow that includes a number of stow examples.

ok, here's a little example i cooked up for ya:

this is our tree of dotfiles and a /etc skeleton directory:

 ___╱╲  _____ ╱╲______ ____╱╲   ___╱╲
 ╲ _  ╲╱  .:╱╱.:╲____╱╱_╲_.  ╲ ╱.╱__ ╲
  ╲╲  ╱    ╱╱    ___╱╱  .╲╱ _╱╱ ╲  ╱  ╲
  ╱.: ╲    ╲_.     ╱╱    _. ╲╱ .:╲╱   ╱
 ╱____╱╲  __╲╱__  ╱╱______│ ╱╲_______╱
        ╲╱      ╲╱        │╱x0^67^iMP!

[~]━━ ━ cd /tmp/test
[/tmp/test]━━ ━ tree .
.
├── dotfiles/
│   ├── cron/
│   │   └── etc/
│   │       └── cron.d/
│   │           ├── daily
│   │           ├── monthly
│   │           ├── weekly
│   │           └── yearly
│   └── motd/
│       └── etc/
│           └── motd.txt
└── etc/
    └── cron.d/

8 directories, 5 files

enter the dotfiles directory, stow the motd file and look at the results:

[/tmp/test]━━ ━ cd dotfiles
[/tmp/test/dotfiles]━━ ━ stow motd
[/tmp/test/dotfiles]━━ ━ tree ../
../
├── dotfiles/
│   ├── cron/
│   │   └── etc/
│   │       └── cron.d/
│   │           ├── daily
│   │           ├── monthly
│   │           ├── weekly
│   │           └── yearly
│   └── motd/
│       └── etc/
│           └── motd.txt
└── etc/
    ├── cron.d/
    └── motd.txt -> ../dotfiles/motd/etc/motd.txt

8 directories, 6 files

repeat the process with the cron directory:

[/tmp/test/dotfiles]━━ ━ stow cron
[/tmp/test/dotfiles]━━ ━ tree ../
../
├── dotfiles/
│   ├── cron/
│   │   └── etc/
│   │       └── cron.d/
│   │           ├── daily
│   │           ├── monthly
│   │           ├── weekly
│   │           └── yearly
│   └── motd/
│       └── etc/
│           └── motd.txt
└── etc/
    ├── cron.d/
    │   ├── daily -> ../../dotfiles/cron/etc/cron.d/daily
    │   ├── monthly -> ../../dotfiles/cron/etc/cron.d/monthly
    │   ├── weekly -> ../../dotfiles/cron/etc/cron.d/weekly
    │   └── yearly -> ../../dotfiles/cron/etc/cron.d/yearly
    └── motd.txt -> ../dotfiles/motd/etc/motd.txt

8 directories, 10 files

create a new file in the cron directory and notice the /etc tree is unaffected:

[/tmp/test/dotfiles]━━ ━ touch cron/etc/cron.d/hourly
[/tmp/test/dotfiles]━━ ━ tree ../
../
├── dotfiles/
│   ├── cron/
│   │   └── etc/
│   │       └── cron.d/
│   │           ├── daily
│   │           ├── hourly
│   │           ├── monthly
│   │           ├── weekly
│   │           └── yearly
│   └── motd/
│       └── etc/
│           └── motd.txt
└── etc/
    ├── cron.d/
    │   ├── daily -> ../../dotfiles/cron/etc/cron.d/daily
    │   ├── monthly -> ../../dotfiles/cron/etc/cron.d/monthly
    │   ├── weekly -> ../../dotfiles/cron/etc/cron.d/weekly
    │   └── yearly -> ../../dotfiles/cron/etc/cron.d/yearly
    └── motd.txt -> ../dotfiles/motd/etc/motd.txt

8 directories, 11 files

run stow again, and the new file is linked into place:

[/tmp/test/dotfiles]━━ ━ stow cron
[/tmp/test/dotfiles]━━ ━ tree ../
../
├── dotfiles/
│   ├── cron/
│   │   └── etc/
│   │       └── cron.d/
│   │           ├── daily
│   │           ├── hourly
│   │           ├── monthly
│   │           ├── weekly
│   │           └── yearly
│   └── motd/
│       └── etc/
│           └── motd.txt
└── etc/
    ├── cron.d/
    │   ├── daily -> ../../dotfiles/cron/etc/cron.d/daily
    │   ├── hourly -> ../../dotfiles/cron/etc/cron.d/hourly
    │   ├── monthly -> ../../dotfiles/cron/etc/cron.d/monthly
    │   ├── weekly -> ../../dotfiles/cron/etc/cron.d/weekly
    │   └── yearly -> ../../dotfiles/cron/etc/cron.d/yearly
    └── motd.txt -> ../dotfiles/motd/etc/motd.txt

8 directories, 12 files

@xero xero added the question label May 10, 2023
@xero xero self-assigned this May 10, 2023
@xero xero pinned this issue Jun 25, 2023
@xero xero changed the title Stupid question understanding gnu stow Jun 25, 2023
@xero xero closed this as completed Jun 25, 2023
@xero xero added the tutorial label Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants