Skip to content

Public to Private Migration

Cormac McCarthy edited this page Sep 8, 2017 · 6 revisions

Public to Private Migration

This guide will outline the steps necessary from moving development in the public repository to the private repository.

Prerequisites

Please ensure that the following steps are completed before making any changes:

  • Create your own fork from the private repository
  • Clone your fork to your machine
    • In your development folder, open Git Bash and run git clone https://github.com/<GITHUB_USERNAME>/azure-powershell-pr.git
  • Create a new remote repository for the Azure fork of the private repository
    • In the root of the repository, open Git Bash and run git remote add upstream https://github.com/Azure/azure-powershell-pr.git
      • This will create a remote called upstream; feel free to use name besides upstream for this remote. The examples to follow will use upstream.

Creating a new branch

If you are looking to create a new branch in the private repository to work out of, follow the below steps in the clone of your fork of the private repository:

  • Fetch the latest changes from the Azure fork of the private repository
    • Run git fetch upstream
  • Create a branch based off of the preview branch in the Azure fork
    • Run git branch <DEV_BRANCH> upstream/preview
  • Switch to your development branch
    • Run git checkout <DEV_BRANCH>
  • Push the branch to your private fork
    • Run git push origin <DEV_BRANCH>

You can now open a pull request from your fork to the Azure fork in the private repository with the changes in your development branch.

Moving an existing branch

If you have an existing branch that you are working out of in the public repository and want to move the changes over to the private repository, follow the below steps in the clone of your fork of the private repository:

  • Create a new remote repository for your fork of the public repository.
    • Run git remote add origin-public https://github.com/<GITHUB_USERNAME>/azure-powershell.git
      • This will create a remote called origin-public; feel free to change this to whatever you are used to or comfortable with
  • Fetch the latest changes from your public fork
    • Run git fetch origin-public
  • Create a branch based off of your development branch in your public fork
    • Run git branch <DEV_BRANCH> origin-public/<DEV_BRANCH>
  • Switch to your development branch
    • Run git checkout <DEV_BRANCH>
  • Push the branch to your private fork
    • Run git push origin <DEV_BRANCH>

You can now open a pull request from your fork to the Azure fork in the private repository with the changes in your development branch.

Working out of a branch in the Azure fork

If a branch was created for you in the Azure fork by the PowerShell team, and you would like to work out of the Azure fork instead of your own fork, follow the below steps in the clone of your fork of the private repository:

  • Fetch the latest changes fromt he Azure fork of the private repository
    • Run git fetch upstream
  • Create a branch based off of the created branch in the Azure fork
    • Run git branch <DEV_BRANCH> upstream/<DEV_BRANCH>
  • Switch to your development branch
    • Run git checkout <DEV_BRANCH>
  • Push any changes to the created branch in the Azure fork
    • Run git push upstream <DEV_BRANCH>

Note: it is preferred that you create a branch from your own fork and work out of that instead of working out of the Azure fork. To do so, follow the same steps above and push to your fork instead of the Azure fork by running git push origin <DEV_BRANCH>.