Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added git-upstream to easily add upstream repository #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ $ brew install git-extras
- `git bug`
- `git promote`
- `git local-commits`
- `git upstream`

## git-extras

Expand Down Expand Up @@ -524,3 +525,11 @@ git obliterate secrets.json
## git-local-commits

List all commits on the local branch that have not yet been sent to origin. Any additional arguments will be passed directly to git log.

## git-upstream <url>

Sets an upstream url, useful when forking repositories and want to set a remote upstream repository.

```bash
$ git upstream git://github.com/visionmedia/git-extras.git
```
16 changes: 16 additions & 0 deletions bin/git-upstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#/bin/sh

upstream="$1"

test -z $upstream && echo "upstream url required" 1>&2 && exit 1

git remote add upstream $upstream &> /dev/null

if [ $? -ne 0 ]; then
read -p "Do you want to overwrite current upstream repository `git config --get remote.upstream.url` ? [yN]: " overwrite
if [ "$overwrite" == "y" ]; then
git config remote.upstream.url $upstream
fi
fi
echo "Remote upstream repository set to `git config --get remote.upstream.url`"

31 changes: 31 additions & 0 deletions man/git-upstream.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-UPSTREAM" "1" "May 2013" "" ""
.
.SH "NAME"
\fBgit\-upstream\fR \- Add/update remote upstream repository
.
.SH "SYNOPSIS"
\fBgit\-upstream\fR <url>
.
.SH "DESCRIPTION"
Adds or updates the remote upstream url\.
.
.SH "OPTIONS"
<url>
.
.P
Remote url\.
.
.SH "EXAMPLES"
$ git upstream git://github\.com/visionmedia/git\-extras\.git
.
.SH "AUTHOR"
Written by Jose V\. Trigueros <\fIj\.v\.trigueros@gmail\.com\fR>
.
.SH "REPORTING BUGS"
<\fIhttps://github\.com/visionmedia/git\-extras/issues\fR>
.
.SH "SEE ALSO"
<\fIhttps://github\.com/visionmedia/git\-extras\fR>
116 changes: 116 additions & 0 deletions man/git-upstream.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions man/git-upstream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
git-upstream(1) -- Add/update remote upstream repository
================================

## SYNOPSIS

`git-upstream` &lt;url&gt;

## DESCRIPTION

Adds or updates the remote upstream url.

## OPTIONS

&lt;url&gt;

Remote url.

## EXAMPLES

$ git upstream git://github.com/visionmedia/git-extras.git

## AUTHOR

Written by Jose V. Trigueros &lt;<[email protected]>&gt;

## REPORTING BUGS

&lt;<https://github.com/visionmedia/git-extras/issues>&gt;

## SEE ALSO

&lt;<https://github.com/visionmedia/git-extras>&gt;