Git fetch after each cd
This commit is contained in:
		
							parent
							
								
									88f23a04e0
								
							
						
					
					
						commit
						0b9d874390
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -64,6 +64,15 @@ 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
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# ---------------------------------------------------------------------------
 | 
			
		||||
#  Editor
 | 
			
		||||
# ---------------------------------------------------------------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue