How to push current branch to an another remote repository as a new branch

git remote -v

This lists all the remote repositories. You will probably see your origin remote repository in here. We will add the new repository information to push there as new branch.

git remote add {remote repository name} {new URL}

{remote repository name} = something like origin but not origin, let’s say neworigin
{new URL} = https://somethinglikethis.git

git remote add neworigin https://somethinglikethis.git

If you run again the first git command, you will see your new remote repository as neworigin.

git push -u neworigin {current branch}:{new branch name}

{current branch} = let’s say you are on the feature branch
{new branch name} = this will be your new branch name on new remote repository

git push-u neworigin feature:newbranch

Software Developer, Into Finance, Insight in Telco, AI Enthusiastic |