[go: up one dir, main page]

Skip to content

Add tip to Git output when cloning a fork

When cloning a fork, it is best practice to add a remote upstream so that you can fetch/checkout changes from the upstream repository easily. We should add tips to the interface, but we can also add output to the command line too.

Proposal

Include the git commands to add the upstream remote in the clone output. Equivalent output should be displayed if cloning the parent projects with details how to add your fork.

$ git clone git@gitlab.com:foo/bar.git
Cloning into 'bar'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 9 (delta 2), reused 0 (delta 0)
remote:
remote: Add remote for upstream repository:
remote:   git remote add upstream git@gitlab.com:fizz/buzz.git
remote:   git branch -u upstream/master
remote:
Receiving objects: 100% (9/9), done.
Resolving deltas: 100% (2/2), done.

Links / references

Edited by James Ramsay (ex-GitLab)