Using git v1.8.0 or later:
git branch branch_name --set-upstream-to your_new_remote/branch_name
Or you can use the -u
switch
git branch branch_name -u your_new_remote/branch_name
Using git v1.7.12 or earlier
git branch --set-upstream branch_name your_new_remote/branch_name
More Related Contents:
- Why do I need to explicitly push a new branch?
- Git merge left HEAD marks in my files
- How can I recover a lost commit in Git?
- How do I ignore files in a directory in Git?
- Checkout subdirectories in Git?
- git diff – show me line ending changes?
- How can I deal with this Git warning? “Pulling without specifying how to reconcile divergent branches is discouraged”
- How do I get the current branch name in Git?
- How do I see the differences between two branches?
- Search all of Git history for a string [duplicate]
- Remove local git tags that are no longer on the remote repository
- What are the differences between local branch, local tracking branch, remote branch and remote tracking branch?
- Can you delete multiple branches in one command with Git?
- git: ‘credential-cache’ is not a git command
- Why is git push gerrit HEAD:refs/for/master used instead of git push origin master
- How to list all Git tags?
- How do I edit an existing tag message in Git?
- error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
- Git fetch/pull/clone hangs on receiving objects
- Create a GitHub repository from command line
- git-clone and post-checkout hook
- How can I revert a single file to a previous version? [duplicate]
- How do I move an existing Git submodule within a Git repository?
- Git : fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
- How to make git status show only staged files
- git: ‘remote-https’ is not a git command?
- How do I deal with corrupted Git object files?
- github: server certificate verification failed
- SourceTree App says uncommitted changes even for newly-cloned repository – what could be wrong?
- How do I write a batch file which opens the GitBash shell and runs a command in the shell?