Improve git fetch
This commit is contained in:
parent
e046927d0d
commit
b3866294bc
1 changed files with 12 additions and 6 deletions
|
|
@ -65,12 +65,17 @@ if command -v tig &>/dev/null; then
|
||||||
alias tiga='tig --all'
|
alias tiga='tig --all'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Function to run after every 'cd' command
|
|
||||||
chpwd() {
|
chpwd() {
|
||||||
# Check if the current directory is a Git repository
|
# Is this directory inside a git repo?
|
||||||
if git rev-parse --is-inside-work-tree 2>/dev/null; then
|
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..."
|
echo "Fetching latest changes from remote..."
|
||||||
git fetch
|
git fetch --quiet
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +153,7 @@ export ZSH_TMUX_DEFAULT_SESSION_NAME=build
|
||||||
if command -v fzf &>/dev/null; then
|
if command -v fzf &>/dev/null; then
|
||||||
|
|
||||||
change_path_and_find_project() {
|
change_path_and_find_project() {
|
||||||
z {{ .projectdir }}
|
cd {{ .projectdir }}
|
||||||
zle fzf-cd-widget
|
zle fzf-cd-widget
|
||||||
zle reset-prompt
|
zle reset-prompt
|
||||||
}
|
}
|
||||||
|
|
@ -217,3 +222,4 @@ if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||||
nix-env -qa --description ".*$1.*"
|
nix-env -qa --description ".*$1.*"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue