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

feature: setup fork command #89

Open
joe-getcouragenow opened this issue Nov 6, 2020 · 2 comments
Open

feature: setup fork command #89

joe-getcouragenow opened this issue Nov 6, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@joe-getcouragenow
Copy link

when a developer clones their fork, the first thing they do is setup the config.

it can be automated with "git remote add upstream git@$(GITR_SERVER)-$(GITR_USER):$(GITR_ORG_UPSTREAM)/$(GITR_REPO_NAME)"

this presumes that your using ssh .

wondering if you think its a good idea to add... ?

@joe-getcouragenow joe-getcouragenow added the bug Something isn't working label Nov 6, 2020
@chriswalz chriswalz changed the title setup fork command feature: setup fork command Nov 7, 2020
@chriswalz chriswalz added enhancement New feature or request and removed bug Something isn't working labels Nov 7, 2020
@chriswalz
Copy link
Owner

This sounds useful but since I don't clone/fork very often I don't quite understand. Similar to the previous issue can you please write the "Current Workflow" and the "Proposed Workflow"

@herbygillot
Copy link
Contributor

herbygillot commented Mar 21, 2021

Say I click the Fork button on your bit repo here on Github.com. It will create a new forked repo for me, herbygillot/bit.

Now if I clone that forked repo down to my machine to hack on, then origin (the default remote destination) will automatically be pointing to herbygillot/bit.

If I push any code changes, they'll go to my forked repo by default.

But since main development is happening in the original repo, chriswalz/bit, then I'll need to add that as a remote so that I can sync the latest changes.

So I add the original repo chriswalz/bit using git remote add:

$ cd <path to my checkout of herbygillot/bit>
$ git remote add upstream git@github.com:chriswalz/bit.git

This adds a new remote destination named upstream, pointing to the original repo (yours).

Now if I need to pull the latest changes from your repo down to my local checked out code, it would look something like:

$ cd <path to my local checkout>
$ git pull upstream/master

If I list my remotes, I should see origin pointing to my repo, and upstream pointing to yours:

$ git remote -v
origin ...herbygillot/bit
upstream ...chriswalz/bit

gh has a fork command that when specified against some repo HTTPS or Git SSH URL, forks it under your username on Github.com and optionally clones it down locally (--clone).

$ gh repo fork git@github.com:chriswalz/bit.git --clone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants