Skip to content

Instantly share code, notes, and snippets.

@nickyleach
Created March 9, 2011 20:12
Show Gist options
  • Save nickyleach/862899 to your computer and use it in GitHub Desktop.
Save nickyleach/862899 to your computer and use it in GitHub Desktop.
git alias to sync the current branch
[alias]
sync = "!f(){ local branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\(.*\\)/\\1/\"`; git pull origin $branch && git push origin $branch; }; f"
@jesuswasrasta
Copy link

Good morning Nick.

I found your git-sync alias quite useful.
I recently published a small post on my blog about it, I hope this would not displease you.
This is the link:
http://jesuswasrasta.com/gitpills/git-pills-a-sync-alias-command-to-pull-and-push-in-one-shot.html

Bye :)
Nando

@kjohnsen
Copy link

kjohnsen commented Jun 4, 2018

Super useful. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment