git reset --hard including submodules
β’ 337 words β’ 2 min β’ updated
Problem statement: Whenever I open Rancher Desktop it insists on modifying my shell rc files. Make it stop!
bash:
# diff --git bash/.bash_profile bash/.bash_profile
index c3962b2..89f475b 100644
--- bash/.bash_profile
+++ bash/.bash_profile
@@ -7,3 +7,7 @@
#
# The following line sources .bashrc and is recommended by http://mywiki.wooledge.org/DotFiles
[ -r ~/.bashrc ] && . ~/.bashrc
+
+### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
+export PATH="/Users/thiago.perrotta/.rd/bin:$PATH"
+### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)
diff --git bash/.bashrc bash/.bashrc
index 7074bca..9ca8ffa 100644
--- bash/.bashrc
+++ bash/.bashrc
@@ -61,3 +61,7 @@ src_files "/etc/bash_completion"
# Load user scripts and functions if existing. Order is important.
# Corp config is handled as part of .bashrc.d.
src_files "$HOME/.profile.d" "$HOME/.bashrc.d"
+
+### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
+export PATH="/Users/thiago.perrotta/.rd/bin:$PATH"
+### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)
zsh:
diff --git etc/zsh/zshrc etc/zsh/zshrc
index efe5f79..02e0539 100644
--- etc/zsh/zshrc
+++ etc/zsh/zshrc
@@ -3959,3 +3959,7 @@ unfunction grml_status_feature
# Local variables:
# mode: sh
# End:
+
+### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
+export PATH="/Users/thiago.perrotta/.rd/bin:$PATH"
+### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)
You could say it’s well-intentioned, but I think it’s rude to change the developer’s rc files without telling them so, and without providing an opt-out mechanism1.
Thus I wanted to revert their changes whenever I was done using Rancher Desktop. This worked:
cd ~/.dotfiles && git reset --hard
cd vendor/grml-etc-core && git reset --hardThe second git reset --hard is needed because I employ a submodule for my
zsh config.
However, after doing this many times in a row, it became tedious. And somehow I have the urge to improve this workflow…

XKCD Courtesy of Randall Munroe
Then I found out it’s possible to do it with an one-shot command, via:
% git reset --hard --recurse-submodulesI knew of --recurse-submodules for git clone, but it never occurred to me it
would also exist for git reset.
-
I ended up finding an opt-out mechanism, which isn’t very intuitive to self-discover: rancher-sandbox/rancher-desktop#7315. ↩︎