bit icon indicating copy to clipboard operation
bit copied to clipboard

feature: setup fork command

Open joe-getcouragenow opened this issue 5 years ago • 2 comments

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 avatar Nov 06 '20 16:11 joe-getcouragenow

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"

chriswalz avatar Nov 07 '20 01:11 chriswalz

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 [email protected]: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 [email protected]:chriswalz/bit.git --clone

herbygillot avatar Mar 21 '21 03:03 herbygillot