Share project git fetch b/w ZSH and SESH
This commit is contained in:
parent
7abac0e4e9
commit
46a372a873
2 changed files with 10 additions and 13 deletions
|
|
@ -66,21 +66,9 @@ if command -v tig &>/dev/null; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chpwd() {
|
chpwd() {
|
||||||
# Is this directory inside a git repo?
|
project_git_fetch
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alias f='git fetch'
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Editor
|
# Editor
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
|
||||||
9
private_dot_local/bin/executable_project_git_fetch
Normal file
9
private_dot_local/bin/executable_project_git_fetch
Normal file
|
|
@ -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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue