Skip to content

Instantly share code, notes, and snippets.

@AtmaMani
Last active July 23, 2019 20:54
Show Gist options
  • Save AtmaMani/82ae477eb3dfb08b3ce162630be8d33d to your computer and use it in GitHub Desktop.
Save AtmaMani/82ae477eb3dfb08b3ce162630be8d33d to your computer and use it in GitHub Desktop.
Push up changes to a PR while reviewing

How to checkout a branch from a fork of your repo?

git remote add <name> <url.git>

This adds the forked repo as a remote. You don't need this if you have merge privileges. You can then fetch and checkout the branch of your choice

git fetch <name or remote>
git checkout <branch_name>  # allow tab completion to help you here.

Pushing your changes up the branch on fork

Often while reviewing a PR from a fork of the orignal repo, it might become beneficial to push up your suggestions into the branch used for the PR. While this is simple if the PR branch lives on the same repo, it can become quite confusing when this branch is from a fork of the origin repo. The step below can be used to push up your changes to the PR branch on forked repo

git push https://github.com/username/forked-repo.git <your-local-branch-name>:<pr-branch-name>

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