mirror of
https://gitea.zaclys.com/yannic/dotfiles.git
synced 2026-05-23 19:37:28 +02:00
Improve git fetch
This commit is contained in:
+12
-6
@@ -65,12 +65,17 @@ if command -v tig &>/dev/null; then
|
||||
alias tiga='tig --all'
|
||||
fi
|
||||
|
||||
# Function to run after every 'cd' command
|
||||
chpwd() {
|
||||
# Check if the current directory is a Git repository
|
||||
if git rev-parse --is-inside-work-tree 2>/dev/null; then
|
||||
echo "Fetching latest changes from remote..."
|
||||
git fetch
|
||||
# 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 --quiet
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ export ZSH_TMUX_DEFAULT_SESSION_NAME=build
|
||||
if command -v fzf &>/dev/null; then
|
||||
|
||||
change_path_and_find_project() {
|
||||
z {{ .projectdir }}
|
||||
cd {{ .projectdir }}
|
||||
zle fzf-cd-widget
|
||||
zle reset-prompt
|
||||
}
|
||||
@@ -217,3 +222,4 @@ if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||
nix-env -qa --description ".*$1.*"
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user