Skip to content
Ben Best edited this page May 21, 2014 · 33 revisions

Process

github.com/[org]/[repo] (org web) github.com/[user]/[repo] (user web) ~/github/[repo] (user local)
->1x -> fork -> clone
<- merge pull request {admin} <- <- [pull request](Fork & Pull Model) <- push, <-> commit

where:

  • [org] is an organization (eg ohi-science)
  • [repo] is a repository in the orgranization (eg ohicore, ohiprep, etc.)
  • [user] is your github username

Other workflows

Resolving Conflicts

See:

In this example, pull request ohi-science/ohicore#94 for bbest/ohicore to update ohi-science/ohicore returns the message:

We can’t automatically merge this pull request. Use the command line to resolve conflicts before continuing.

Checkout via command line

If you cannot merge a pull request automatically here, you have the option of checking it out via command line to resolve conflicts and perform a manual merge.

HTTP: https://github.com/bbest/ohicore.git

Step 1: From your project repository, check out a new branch and test the changes.

git checkout -b bbest-master master
git pull https://github.com/bbest/ohicore.git master

Step 2: Merge the changes and update on GitHub.

git checkout master
git merge --no-ff bbest-master
git push origin master

Here are the extra steps to resolve this conflict. First, you need a local copy of ohi-science/ohicore in a temporary directory.

cd /Users/bbest/Github_Mac
mkdir tmp; cd tmp
git clone https://github.com/ohi-science/ohicore.git
cd ohicore

Then checkout a new branch bbest-master based on master, and overwrite with the bbest repo.

git checkout -b bbest-master master
git pull https://github.com/bbest/ohicore.git master

The Auto-merging will then detect CONFLICTs. In this case:

CONFLICT (content): Merge conflict in inst/extdata/tmp/layers_navigation_2012a_2013a.csv

Look at the various versions of the file

# local
open inst/extdata/tmp/layers_navigation_2012a_2013a.csv

# ohi-science web
open https://github.com/ohi-science/ohicore/blob/master/inst/extdata/tmp/layers_navigation_2012a_2013a.csv

# bbest web
open https://github.com/bbest/ohicore/blob/master/inst/extdata/tmp/layers_navigation_2012a_2013a.csv

Let's overwrite with the raw online version of the file from the bbest repo.

curl -L -o inst/extdata/tmp/layers_navigation_2012a_2013a.csv "https://raw.github.com/bbest/ohicore/master/inst/extdata/tmp/layers_navigation_2012a_2013a.csv"

Once the conflicts are resolved, mark the resolved file(s) with git add and then commit with a message.

git add inst/extdata/tmp/layers_navigation_2012a_2013a.csv
git commit -m "resolved conflict with inst/extdata/tmp/layers_navigation_2012a_2013a.csv by overwriting with bbest version"
git status

Finally, merge the branches and push back to github.

git checkout master
git merge --no-ff bbest-master
git push origin master

Issues

Styling

Markdown

Reproducible Science

Clone this wiki locally