I\'ve been wondering if there\'s an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names.
For exa
Here's the process that has worked for me.
git clone original-repo-url
git remote rename origin upstream
git remote add origin new-repo-url
Now your new repo will be ‘origin’ and the original repo is ‘upstream’. Confirm it by running git remote -v. (Side note: Upstream is used to fetch from the original repo - in order to keep your local copy in sync with the project you want to contribute to - and origin is used to pull and push since you can contribute to your own repo).
git push origin master
Now your new remote repo's master (on Github) will be in-sync with the original master, but it won't have any of the feature branches.
git rebase upstream/branch-name
git push origin master
Rebase is a smart merge. Then push to master again and you’ll see the selected feature branch as master on the new repo.
Optional:
git remote rm upstream
git remote add upstream new-repo-url