Skip to content

Commit 00f2cb1

Browse files
committed
Add git-upstream-sync
1 parent 845799e commit 00f2cb1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ git clone this repository, then add it to your `$PATH`. Nothing here actually re
129129
* git-unpushed - Zach Holman's [dotfiles](https://github.com/holman/dotfiles)
130130
* git-unreleased - Mislav Marohnić's [dotfiles](https://github.com/mislav/dotfiles)
131131
* git-up - Ryan Tomayko's [dotfiles](http://github.com/rtomayko/dotfiles)
132+
* git-upstream-sync - One of my personal scripts
132133
* git-when-merged - Michael Haggerty [git-when-merged](https://github.com/mhagger/git-when-merged)
133134
* git-where - Mislav Marohnić's [dotfiles](https://github.com/mislav/dotfiles)
134135
* git-winner - Garry Dolley [https://github.com/up_the_irons/git-winner](https://github.com/up_the_irons/git-winner)

git-upstream-sync

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Author: Joe Block <jpb@unixorn.net>
4+
# License: Apache 2.0
5+
# https://github.com/unixorn/git-extra-commands/blob/master/LICENSE
6+
#
7+
# Sync to upstream/yourforkname and rebase into your local fork. then push
8+
#
9+
# Assumes that your upstream fork's remote is named upstream
10+
11+
branch_name=$(git symbolic-ref --short -q HEAD)
12+
13+
git fetch upstream && \
14+
git rebase upstream/${branch_name} && \
15+
git push && \
16+
git fetch -p

0 commit comments

Comments
 (0)