Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.19 KB

github_fork_notes.md

File metadata and controls

62 lines (42 loc) · 1.19 KB

Git fork workflow (Reference)

  • Fork the repository, then clone the fork
$ git clone https://github.com/waynee95/<fork>.git
  • Add original repository as upstream to be able to fetch latest updates
$ git remote add upstream https://github.com/<org>/<original-repo>.git

Adding a new feature

  1. Create and checkout a feature branch
  2. Make changes to the files
  3. Commit changes to the branch/fork
$ git checkout -b <new branch>
$ git push origin <new branch>

Then create a PR in the original repository.

Cleaning up

  • After the feature was merged, update the fork
$ git pull upstream master
  • Delete the feature branch, as not needed anymore
$ git branch -d <branch name>
  • Update the master branch of the fork
$ git push origin master
  • And also delete the feature branch in the remote repository
$ git push --delete origin <branch name>

Keeping fork in sync

  • Make sure to always have the most recent version in the fork, since forks do not update automatically!
git pull upstream master
git push origin master