Skip to content

Instantly share code, notes, and snippets.

@Fallenstedt
Last active April 9, 2024 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fallenstedt/14b8b4db7642b301e5281f37ab469234 to your computer and use it in GitHub Desktop.
Save Fallenstedt/14b8b4db7642b301e5281f37ab469234 to your computer and use it in GitHub Desktop.
Syncs upstream branch with local branch
#!/bin/bash
if [ -d ".git" ]; then
echo "git repo detected"
echo "checking out $1..."
git checkout $1
echo "fetching origin $1..."
git fetch origin $1
echo "merging origin $1 to local $1..."
git merge origin/$1
echo "done"
else
echo "no git repo detected"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment