zooniverse / wildcam-gorongosa

http://www.wildcamgorongosa.org
Apache License 2.0
2 stars 6 forks source link

Bridget content edits #198

Closed conneelyb closed 8 years ago

conneelyb commented 8 years ago

Please approve these edits to the field guide, going back to Sept 10th.

shaunanoordin commented 8 years ago

Review:

Action:

shaunanoordin commented 8 years ago

Action Requested:

shaunanoordin commented 8 years ago

@conneelyb , apologies if my comments were too abrupt - @aliburchard reminded me that it'd be helpful if I provided more information of what's wrong and what needs to be done.

The situation: This Pull Request cannot be merged into the original Wildcam Gorongosa repo.

Why this is happening: This Pull Request uses a branch based on (the master branch of) your forked Wildcam Gorongosa repo, and that forked repo('s master branch) is now out-of-date since the original repo('s master branch) has been updated.

What needs to be done: Before this Pull Request can be merged, you first need to update the master branch of your forked WG repo (https://github.com/conneelyb/wildcam-gorongosa) so it's synchronised with the master branch of the original WG repo (https://github.com/zooniverse/wildcam-gorongosa).

How to do this: This article should help: https://help.github.com/articles/syncing-a-fork/

It boils down to:

If you encounter any merge conflicts, these should be fairly minor - some information/text differences here and there that need to be manually fixed.

If you do not encounter any conflicts from merging, great, this means everything's going according to plan.

What next: Once your forked repo's master branch is fully in sync with the original repo's master branch, let us know on this discussion thread. We can then re-examine the Pull Request, and if all goes well, we should be able to perform a merge automatically.

Note: you may also want to update your online forked repo with your new local forked.

What if something goes horribly wrong: Contact me and I'll discuss Plan B: Manual Merging.

Discussions: This issue stemmed from synchronising a forked repo with the original (upstream) repo. As such, I was wondering why you forked the WG repo instead of simply creating a branch in it, which should facilitate relatively simpler merging. I'm not criticising your decision, as I am fairly new to Git myself, but I would like to understand your rationale so we can discuss future best practices.

conneelyb commented 8 years ago

Hi @shaunanoordin - Thanks so much for the detailed advice on fixing this issue. I am definitely very new to GitHub, so any advice on how to do this more efficiently in the future is more than welcome! I will try to make the changes that you suggested and I'll let you know how it goes.

In terms of rationale, I mostly just followed the basic instructions from Ali: "to make changes, you'll want to fork the repo, create a new branch (called "bridget-content-edits" or something"), make the text changes in the relevant files, and then submit a pull request.".. And then I just researched how to do each of those steps, but being new to GitHub, I didn't realize that there was an easier way (or maybe I misinterpreted the instructions). I am happy to try it the other way next time.

Thanks! Bridget

srallen commented 8 years ago

@shaunanoordin re: why someone would make a fork instead of a branch of the original repo:

It's a permissions issue. A github user can't just pull down a public repo and push a new branch back up without being added as a collaborator. We should consider adding researcher team members who want to contribute to code repositories as an outside collaborator and adding contributing.md files to our repos to make it clear how to fork, submit pull requests, and rebase with master or to request being added as an outside collaborator (if we decide we want to do this).

conneelyb commented 8 years ago

Hi @shaunanoordin,

I gave this a shot and I'm not entirely sure if it worked properly. In case it's helpful, here is are my terminal commands:

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git clone https://github.com/conneelyb/wildcam-gorongosa.git Cloning into 'wildcam-gorongosa'... remote: Counting objects: 2552, done. remote: Compressing objects: 100% (268/268), done. remote: Total 2552 (delta 179), reused 0 (delta 0), pack-reused 2284 Receiving objects: 100% (2552/2552), 64.48 MiB | 21.43 MiB/s, done. Resolving deltas: 100% (1450/1450), done. Checking connectivity... done.

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git remote add origin https://github.com/conneelyb/wildcam-gorongosa.git

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git remote add upstream https://github.com/zooniverse/wildcam-gorongosa.git

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git remote -v origin https://github.com/conneelyb/wildcam-gorongosa.git (fetch) origin https://github.com/conneelyb/wildcam-gorongosa.git (push) upstream https://github.com/zooniverse/wildcam-gorongosa.git (fetch) upstream https://github.com/zooniverse/wildcam-gorongosa.git (push)

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git fetch upstream remote: Counting objects: 2272, done. remote: Compressing objects: 100% (7/7), done. remote: Total 2272 (delta 0), reused 0 (delta 0), pack-reused 2265 Receiving objects: 100% (2272/2272), 64.41 MiB | 23.73 MiB/s, done. Resolving deltas: 100% (1254/1254), done. From https://github.com/zooniverse/wildcam-gorongosa

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git checkout master Branch master set up to track remote branch master from upstream. Already on 'master'

hqlm-se-conneely:conneelyb_wildcam-gorongosa conneelyb$ git merge upstream/master Already up-to-date.

marten commented 8 years ago

Hi @conneelyb

Those commands seem fine to me (though I don't think you needed that initial git clone since you were already in one).

After that, you still need to update your branch to incorporate the changes from upstream/master:

# switch to your branch
git checkout bridget-content-edits

# merge in whatever changed on master
git merge master

You'll likely get a message about merge conflicts after running that. You'll see that the files it mentions will have gotten sections in them that look somewhat like:

<<<<<<< HEAD
nine
=======
eight
>>>>>>> bridget-content-edits

This means that someone changed the same like as you did. Since it's a conflicting change, it's up to you to decide how to merge the two changes, probably by trying to remember what you wanted to be changed on that line, and redoing that. Remove all the <<<, === and >>> afterwards, that's just there to show you where it went wrong.

When you're done, just git add and git commit the results, and then git push origin bridget-content-edits to update this pull request with your changes.

conneelyb commented 8 years ago

Thanks @marten - I gave your instructions a try and I think it worked... here are the commands I used and let's see if everything looks right on your end:

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git checkout bridget-content-edits Branch bridget-content-edits set up to track remote branch bridget-content-edits from origin. Switched to a new branch 'bridget-content-edits'

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git add .

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git commit -m "Education edits" [bridget-content-edits 9548e24] Education edits 4 files changed, 11 insertions(+), 11 deletions(-)

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git push origin bridget-content-edits Password for 'https://conneelyb@github.com': Counting objects: 11, done. Delta compression using up to 4 threads. Compressing objects: 100% (8/8), done. Writing objects: 100% (11/11), 995 bytes | 0 bytes/s, done. Total 11 (delta 10), reused 3 (delta 3) To https://conneelyb@github.com/conneelyb/wildcam-gorongosa.git fc9dad8..9548e24 bridget-content-edits -> bridget-content-edits

marten commented 8 years ago

You seem to have added only a normal commit. I think you might have missed the git merge master command?

conneelyb commented 8 years ago

Hi @marten,

Thanks so much for your patience with this - as you can tell, I'm a newbie but I'm learning!

Here is are the new commands that I used and I think it worked this time:

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git checkout bridget-content-edits Already on 'bridget-content-edits' Your branch is up-to-date with 'origin/bridget-content-edits'.

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git merge master Merge made by the 'recursive' strategy.

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git add .

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git commit -m "Education edits" On branch bridget-content-edits Your branch is ahead of 'origin/bridget-content-edits' by 7 commits. (use "git push" to publish your local commits) nothing to commit, working directory clean

hqlm-se-conneely:wildcam-gorongosa conneelyb$ git push origin bridget-content-edits Counting objects: 1, done. Writing objects: 100% (1/1), 249 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) To https://conneelyb@github.com/conneelyb/wildcam-gorongosa.git 9548e24..5821317 bridget-content-edits -> bridget-content-edits

shaunanoordin commented 8 years ago

I apologise for disrupting this thread, but I've taken some time to examine the current status of this Pull Request and I realised that some manual intervention will be required. Notably, some formatting changes introduced in this PR won't appear correctly; notably, species name in the description fields will appear literally (tags and all), not italicised.

I've taken the initiative to run fixes. Please review #199 as a replacement PR candidate.

conneelyb commented 8 years ago

@shaunanoordin I am planning to make some minor edits to a page on the main WildCam site and, to prevent any similar issues to last time, I am hoping you can send me a list of steps that you recommend for making an edits and submitting a pull request. If you are able to send example terminal commands as well, that would be helpful. Then I'll save these instructions and use this process going forward. Thanks!

shaunanoordin commented 8 years ago

@conneelyb

So You Want To Submit A PR To A Zooniverse Github Repository

Option A: Are you a Collaborator on the project?

i.e. can you push branches directly to, say, https://github.com/zooniverse/wildcam-gorongosa ?

If no - or unsure - go straight to Option B.

If yes, do the following...

Step 1: Clone the project to your computer

-if you haven't done so already.

> cd ~/projects
> git clone https://github.com/zooniverse/wildcam-gorongosa.git

Open the repo on your computer. You should be on the default master branch

> cd ~/projects/wildcam-gorongosa
> git status 
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

Step 1A: What if I've already cloned the repo before?

If you have, then it's likely that (i) you're not starting at the default master branch, and (ii) your local repo may be out of date to the origin. (i.e. the repo on Github).

Let's fix that.

> git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

> git fetch
remote: Counting objects: 310, done.
...yadda yadda...

> git pull
Updating 0df1fa0..9533787
Fast-forward
...yadda yadda...

Step 2: Create a branch

Now create your branch and give it a nice name. Then, switch to (check out) the branch.

> git branch add-monkeys
> git checkout add-monkeys

Step 3: Make your changes

You can always confirm that you're on the correct branch by using git status

> git status
On branch add-monkeys
nothing to commit, working directory clean

After you add, edit or delete files, commit the changes.

> git add .
> git commit

Step 4: Push your changes and make a Pull Request

> git push origin add-monkeys

Then go to https://github.com/zooniverse/wildcam-gorongosa/pulls and click 'New Pull Request'. Choose your branch and follow the instructions from there.

Step 5: Wait while somebody reviews your Pull Request

Doot dee doo dee doo


Option B: It's about Forking time

If you don't have access to the Zooniverse repo, you'll need to fork it first - i.e. create a copy of the original repo on your Github account.

And then it gets complicated.

Be sure of the chain: upsteam -forked-> origin -cloned-> local

Step 1: Fork the Repo

Go to https://github.com/zooniverse/wildcam-gorongosa/, click the Fork button and follow the instructions.

You should now have a copy of the repository at https://github.com/SHAUNANOORDIN/wildcam-gorongosa/

Step 1A: What if I've already forked the repo?

You have two options. First, let's say that there's nothing important in your origin repo - you can simply delete it and start again.

Go to https://github.com/SHAUNANOORDIN/wildcam-gorongosa/settings and find the Danger Zone link to 'Delete this repository'.

Step 1B: Alternatively...

Second, there's the "proper way".

If you haven't cloned your forked repo (the origin), here's the setup phase:

> cd ~/projects
> git clone https://github.com/SHAUNANOORDIN/wildcam-gorongosa.git   #ORIGIN#
> cd ~/projects/wildcam-gorongosa

If you've already cloned the origin, here's the update (get-latest-changes) phase:

> cd ~/projects/wildcam-gorongosa
> git checkout master
> git fetch
> git pull

(See Option A: Step 1 and Step 1A for more info)

Now, make sure your local repo knows where the upstream (original) repo is.

Use git remote to see which external repos your local is aware of. (i.e., "remote repositories") At this point, it should only show your origin repo.

> git remote -v
origin https://github.com/SHAUNANOORDIN/wildcam-gorongosa.git (fetch)
origin https://github.com/SHAUNANOORDIN/wildcam-gorongosa.git (push)

If you don't see the upstream repo, add it.

> git remote add upstream https://github.com/zooniverse/wildcam-gorongosa
> git remote -v 
origin https://github.com/SHAUNANOORDIN/wildcam-gorongosa.git (fetch)
origin https://github.com/SHAUNANOORDIN/wildcam-gorongosa.git (push)
upstream https://github.com/zooniverse/wildcam-gorongosa.git (fetch)
upstream https://github.com/zooniverse/wildcam-gorongosa.git (push)

Here's the deal: at this stage, your local repo is based on your origin repo. However, your origin repo is probably out of date compared to the original upstream repo.

What you need to do now is synchronise your local repo with the latest from the upstream repo.

> git fetch upstream
> git checkout master
> git merge upstream/master

You can also update your origin repo at this stage, so all three repos are in sync.

> git push origin master

Read these for more info:

Step 2: Create a branch

Now create your branch and give it a nice name. Then, switch to (check out) the branch.

> git branch add-monkeys
> git checkout add-monkeys

Step 3: Make your changes

You can always confirm that you're on the correct branch by using git status

> git status
On branch add-monkeys
nothing to commit, working directory clean

After you add, edit or delete files, commit the changes.

> git add .
> git commit

Step 4: Push your changes and make a Pull Request...

...but here's the trick: you push your changes to the origin, but make the Pull Request at the upstream repo.

> git push origin add-monkeys

Then go to https://github.com/zooniverse/wildcam-gorongosa/pulls and click 'New Pull Request'.

Choose your branch - which would be listed as SHAUNANOORDIN/wildcam-gorongosa:add-monkeys - and follow the instructions from there.

If you have trouble finding your branch, see if there's a link on the upstream's Pull Request page that says "compare across forks".

Step 5: Wait while somebody reviews your Pull Request

Doot dee doo dee doo

aliburchard commented 8 years ago

This is a really fantastic intro to PRs for Zooniverse contributors more broadly. Thanks @shaunanoordin

conneelyb commented 8 years ago

@shaunanoordin Thank you so much! This is really helpful. I am unsure if I am a collaborator (I think not), so I will go with option B. I will work on the edits and send a PR this week (and hopefully not screw it up)!

shaunanoordin commented 8 years ago

No worries, @conneelyb. If you encounter any problems with your attempts to create your edits, or if you encounter unexpected error messages while following the instructions, let me know and we'll see how we can solve them together.