#git #github #bitbucket
https://codingbeast.org/copy-branch-f...
How to copy a branch from one repository to second remote repository.
To transfer your branch (Branch A) from the old repository to a new one, you have two options. The first method involves adding a new remote (Organization) to your old repository (master) and then pushing Branch A to the new repository. Execute the following commands in your terminal:
cd old repository
git remote add origin2 new_url
git push origin2 branch A
This sequence adds a new remote and pushes Branch A to the new repository. Subsequently, your new repository should now include the newly transferred Branch A.
Alternatively, the second method allows you to update the current repository's remote to point to the new location and then push the branch. Use the following commands:
git remote set-url origin new url
git push origin branch A
Both approaches yield the same result; however, the distinction lies in the fact that the first method involves adding a new remote, while the second method modifies the existing remote to point to the new location. Choose the approach that best suits your workflow.
Watch video Copy Branch from One Repo to Another in Git online without registration, duration hours minute second in high quality. This video was added by user ReactJS tutorials 12 November 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,903 once and liked it 12 people.