Forking workflow
- Joe has a local and a remote repository. https://github.com/joe/demo
- Mary “fork” the repository of Joe creating a remote copy of her own: https://github.com/mary/demo
- Mary clones her remote repository to the local disk
- Mary creates a local branch called ‘feature’, makes some changes, pushes the changes out to the ‘feature’ branch in her own remote repo.
- Mary sends a “pull request” to Joe asking Joe to integrate the changes to the
mainbranch of his own repository. - If Joe has comments, he makes them. Mary can make further changes in the ‘feature’ branch, and push them out.
- Once Joe is satisfied with the pull-request he accepts it merging the changes to his own
mainbranch. - Mary sets up the remote repository of Joe to be a remote repository of her own. (She only needs to do this once per repo.) git remote add upstream https://github.com/joe/demo.git
- Mary changes to
mainlocally, and pulls from Joe:git checkout mainandgit pull upstream main - Mary can then delete the local and remote ‘feature’ branch.
- If Mary already has other feature branches she might want to rebase them onto
mainso they will be based on the most recent changes.
Working with remote repository
-
fork repository (service of the host)
-
git clone
-
git push
-
git pull (fetch and merge or fetch and rebase)
-
Send Pull-Request (service of the host)
-
git remote add upstream ..
-
git pull upstream master