/dev/null; then async "git rev-list HEAD...origin/master --count" notify_callback fi builtin cd "$@"}Place this in your .bashrc to override the cd command.Better approach: (( $(git rev-list HEAD..@{u} —count) > 0..." />/dev/null; then async "git rev-list HEAD...origin/master --count" notify_callback fi builtin cd "$@"}Place this in your .bashrc to override the cd command.Better approach: (( $(git rev-list HEAD..@{u} —count) > 0..." />Auto Notify Git Pull | Scribe by Hemanth

Hemanth's Scribes

opensource

Auto Notify Git Pull

Author Photo

Hemanth HM

Thumbnail

A script that upon entering a directory asynchronously checks git remotes for updates.

function cd() {
  async() {
    { $2 $($1) }&
  }
  
  notify_callback() {
    [[ $1 > 0 ]] && echo "You have new stuff to pull!"
  }
  
  # If it's a git repo, check if we need to pull.
  if git rev-parse --is-inside-work-tree &>/dev/null; then
    async "git rev-list HEAD...origin/master --count" notify_callback
  fi
  
  builtin cd "$@"
}

Place this in your .bashrc to override the cd command.

Better approach: (( $(git rev-list HEAD..@{u} —count) > 0 )) && echo “There are new things to merge”

#git#bash#cli
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.