Skip to content

More information about forks and pull requests

Gonzalo Ruzafa edited this page Aug 12, 2015 · 1 revision

About maintainig syncronized our fork with the Origin Repository, you can check the official documentation at:

https://help.github.com/articles/syncing-a-fork/

Alternative 1

We bring information from the Origin

$ git fetch upstream

We locate ourselves at the branch that we want to syncronize ([target branch])

$ git checkout [target branch]

We make a Merge or a Rebase from the [origin branch] correspondent upstream, tipically with the same name.

$ git merge upstream/[origin branch]

or

$ git rebase upstream/[origin branch]

Alternative 2

We locate ourselves at the branch that we want to syncronized ([target branch])

$ git checkout [target branch]

We perform a pull (fetch and merge) directly form the upstream and the origin branch

$ git pull upstream [origin branch]

Alternative 3

In a single step we perform the pull from upstream and origin branch to a different target branch (it only works if we are doing a fast-forward) source

$ git fetch upstream [branch origen]:[branch destino]

About how to make modifications with pull requests

Alternative 1

We update with any of the previous steps. We perform the code modifications. We locate at the branch from wich we want to make a Fix, for example:

$ git checkout 8.0

We create and locate ourselves at a branch for the modification. For ex:

$ git checkout -b 8.0.fix1

We perform a commit, for example:

$ git commit -am 'FIX partner onchange'

We upload this new branch

$ git push origin 8.0.fix1

Alternative 2

We update the remote upstream

$ git fetch upstream

We generate a new branch for the modification ([branch mod]) from upstream/[origin branch]

$ git checkout -b [branch mod] upstream/[origin branch]

We perfrom a commit, for example:

$ git commit -am 'FIX partner onchange'

We upload this new branch

$ git push origin [branch mod]

We propose a pull request

We enter the uploaded branch and we create the pull request