Skip to content

Instantly share code, notes, and snippets.

@thodges-gh
Last active May 26, 2020 23:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thodges-gh/b33bbbedf8346e8212c34e96739b543d to your computer and use it in GitHub Desktop.
Save thodges-gh/b33bbbedf8346e8212c34e96739b543d to your computer and use it in GitHub Desktop.

Forking and making changes to a private repo

  1. Fork the repo in Github to your account (exampleorg/examplerepo -> personal/examplerepo)
  2. Clone your fork of the repo
git clone git@github.com:personal/examplerepo.git
  1. Add the remote of the original repo as the upstream
git remote add upstream git@github.com:exampleorg/examplerepo.git
  1. Fetch the branches from upstream
git fetch upstream
  1. Checkout a local branch based on the upstream's branch
git checkout -b my-branch upstream/target-branch
  1. Make your changes to the branch, add the changes, and commit
git add .
git commit -m "My commit"
  1. Push your changes to your fork
git push origin my-branch
  1. Go to Github and open a pull request
  2. Change the base branch to the target-branch of the base repository

Future changes can be completed by repeating from step 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment