Skip to content

Commit 324d60c

Browse files
committed
Add the two rehome commands in a bash alias file and comment them in the readme
1 parent e5a44ad commit 324d60c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.bash_aliases

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
source-existing-file ~/.include/.post/.bash_aliases
2+
3+
################################################################################
4+
# Aliases used to proctor updating this repo when it's added as a submodule..
5+
# https://github.com/Skenvy/dotfiles?tab=readme-ov-file#use-as-home-is-another-repo
6+
# You'll need to manually run the dotfiles-submodule-symlinks the first time to
7+
# put the links in place (e.g. link _this_ file in place). But once you've done
8+
# that you can just "rehome" to update the submodule to latest.
9+
10+
# For using this repo as a submodule
11+
alias rehome="git submodule update --remote && git add dotfiles && CLOBBER_HOME=GRACEFULLY ~/dotfiles/bin/dotfiles-submodule-symlinks && git diff --cached dotfiles && git status"
12+
alias rehome_undo="git restore --staged dotfiles && git restore dotfiles && git submodule update && CLOBBER_HOME=GRACEFULLY ~/dotfiles/bin/dotfiles-submodule-symlinks && git status"
13+
14+
################################################################################
15+
# The above are two aliases relevant to using this repoistory as a submodule as
16+
# described by the README. For any additional aliases I use, I've added them
17+
# only in https://github.com/Skenvy/dotfiles/blob/home/.bash_aliases my home.
18+
19+
source-existing-file ~/.include/.post/.bash_aliases

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ Now with a `.gitmodules` file that places **this repository** in the `dotfiles`
174174
```
175175
With the submodule initialised and updated we can now symlink its contents into `$HOME`.
176176
177+
> [!TIP]
178+
> Once you've followed the rest of these steps the _first_ time, repeating them again is as simple as using the `rehome` alias seen in [`main`'s `~/.bash_aliases`](https://github.com/Skenvy/dotfiles/blob/main/.bash_aliases).
179+
177180
Remember to read the above section on [dotfiles-submodule-symlinks](https://github.com/Skenvy/dotfiles/tree/main?tab=readme-ov-file#dotfiles-submodule-symlinks) to understand how to manage the case of checking-in a file to the repository that submodules this one where the file matches a file path that already exists in this repository without having to set `CLOBBER_CHECKEDIN_ROOT` to its most destructive option of `REPLACE`.
178181
> [!CAUTION]
179182
> `CLOBBER_HOME=DESTRUCTIVELY` will **force** symlinks (`ln -sf`) to write over files.

0 commit comments

Comments
 (0)