Skip to content

Instantly share code, notes, and snippets.

@stand-sure
Created July 14, 2022 12:30
Show Gist options
  • Select an option

  • Save stand-sure/612e781ea7a175b9aa9e41aaf35e76d8 to your computer and use it in GitHub Desktop.

Select an option

Save stand-sure/612e781ea7a175b9aa9e41aaf35e76d8 to your computer and use it in GitHub Desktop.
Git catch up current branch
#! /bin/bash
# checkout-pull-prune.sh
branchName=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
git fetch origin "$branchName:$branchName"
git merge "$branchName"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment