Skip to content

Private to Public Migration

maddieclayton edited this page Sep 26, 2017 · 1 revision

Private to Public Migration

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

Prerequisites

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

  • Create your own fork from the public 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.git
  • Create a new remote repository for the Azure fork of the public repository
    • In the root of the repository, open Git Bash and run git remote add upstream https://github.com/Azure/azure-powershell.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 public repository to work out of, follow the below steps in the clone of your fork of the public repository:

  • Fetch the latest changes from the Azure fork of the public 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 public fork
    • Run git push origin <DEV_BRANCH>

You can now open a pull request from your fork to the Azure fork in the public 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 private repository and want to move the changes over to the public repository, follow the below steps in the clone of your fork of the public repository:

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

You can now open a pull request from your fork to the Azure fork in the public 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 public repository:

  • Fetch the latest changes from the Azure fork of the public 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>.