I have a git repo that is a fork of another repo. As a rule I will normally add a remote called upstream, which is the original repo I forked from.
$ git remote -v
origin git@github.com:skela/awesomeproject.git (fetch)
origin git@github.com:skela/awesomeproject.git (push)
upstream git://github.com/bob/awesomeproject.git (fetch)
upstream git://github.com/bob/awesomeproject.git (push)
Is there any way to have this additional remote persist across clones? Say I delete my local repository and do a:
git clone git@github.com:skela/awesomeproject.git
And now I recheck my remotes:
$ git remote -v
origin git@github.com:skela/awesomeproject.git (fetch)
origin git@github.com:skela/awesomeproject.git (push)
My upstream remote has vanished!
How to I ensure that my git repo always keeps these 2 remote aliases?
Edit: Just adding the main reason why I want to do this as to shape some of the answers down an acceptable path ;)
Goal is to have a branch in my repo that tracks the upstream's master.
[remote "upstream"]
url = git://github.com/bob/awesomeproject.git
fetch = +refs/heads/*:refs/remotes/upstream/*
[branch "father"]
remote = upstream
merge = refs/heads/master
In other words, the branch "father" which is in my repo tracks the remote called upstream's master branch.
It all works great once I set it up, but as soon as I clone the repo again, the "father" branch points to origin instead of the upstream.