branch pull request

Vineet S 1,390 Reputation points
2024-10-22T12:15:44.6666667+00:00

How can we move branch from 1 repo to another repo... from an example

Branch1 move to devrepo-- UATRepo Branch1

could you please share screenshot...to move it manually without codings as mentioned below

Clone the source repository to your local machine:

Checkout the branch that you want to move:

Create a new branch in the target repository:

Push the changes to the target repository:

Community Center | Not monitored
{count} votes

Accepted answer
  1. Amira Bedhiafi 33,866 Reputation points Volunteer Moderator
    2024-10-22T14:37:41.5033333+00:00

    To move a branch from one repository to another without using code, you can follow these steps manually. Here's a simple guide based on the outline you shared:

    Steps to Move a Branch (Branch1) from devrepo to UATRepo:

    1. Clone the Source Repository (devrepo)

    • Open a terminal or Git Bash and run:
      
           git clone https://your-url-to-devrepo.git
      
      
      • Navigate to the cloned repository:
        
             cd devrepo
        
        

    2. Checkout the Branch You Want to Move

    • After you navigate to the source repo, checkout the specific branch (Branch1):
      
           git checkout Branch1
      
      

    3. Add the Target Repository (UATRepo) as a Remote

    • Add the UATRepo as a new remote:
      
           git remote add UATRepo https://your-url-to-UATRepo.git
      
      

    4. Push the Branch to the Target Repository

    • Push Branch1 to the UATRepo:
      
           git push UATRepo Branch1
      
      

    Without Coding (Using GUI Tools):

    If you're using a GUI like GitHub Desktop, Azure DevOps, or SourceTree, you can do the following:

    1. Clone the source repo using the GUI interface.
    2. Switch to the branch you want to move (Branch1).
    3. Add the target repository (UATRepo) as a new remote in the GUI.
    4. Push the branch to the UATRepo by selecting it from the GUI's push or publish options.

    No coding is needed for these actions, and the GUI will guide you with buttons to clone, checkout, add remotes, and push branches.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.