diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl index df2d389..9f5cf40 100644 --- a/dot_zshrc.tmpl +++ b/dot_zshrc.tmpl @@ -66,21 +66,9 @@ if command -v tig &>/dev/null; then fi chpwd() { - # Is this directory inside a git repo? - if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - - # Are we at the repo root? (prefix empty = root) - - if [ -z "$(git rev-parse --show-prefix)" ]; then - echo "Fetching latest changes from remote..." - git fetch - fi - - fi + project_git_fetch } -alias f='git fetch' - # --------------------------------------------------------------------------- # Editor # --------------------------------------------------------------------------- diff --git a/private_dot_local/bin/executable_project_git_fetch b/private_dot_local/bin/executable_project_git_fetch new file mode 100644 index 0000000..804ad3a --- /dev/null +++ b/private_dot_local/bin/executable_project_git_fetch @@ -0,0 +1,9 @@ +#!/usr/bin/env zsh +# Is this directory inside a git repo? +if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + # Are we at the repo root? (prefix empty = root) + if [ -z "$(git rev-parse --show-prefix)" ]; then + echo "Fetching latest changes from remote..." + git fetch + fi +fi \ No newline at end of file