edamontology / edamontology

EDAM is an ontology of bioscientific data analysis and data management. EDAM concentrates on topics, operations, types of data, and data formats related to analysis, modelling, optimisation, and data life-cycle in biosciences, and in other research and science-based applications.
Creative Commons Attribution Share Alike 4.0 International
117 stars 58 forks source link

Set up an "offline" Git repository #616

Open matuskalas opened 3 years ago

matuskalas commented 3 years ago

This is not a proper issue, but a good first task of setting up a clone of this repository on a local or remote computer, for everyone who wants to edit EDAM locally (or on a remote machine via ssh).

  1. Fork this repository into your user space on GitHub (read below if not sure how).
  2. Clone it onto your local machine.
  3. Set up your local repository, following the instructions in CONTRIBUTING.md#git-setup-on-your-local-machine.
  4. Try if ./.githooks/pre-commit runs inside your cloned edamontology repo.
  5. Make a dummy change in EDAM_dev.owl using a text editor, and try to commit it to a new, experimental Git branch (see below if you need to learn or refresh Git: commits, branches). The commit should work, and you should see the output Yay! Your commit to EDAM Ontology was successful.. (For comparison see Example 1 below)
  6. Now replace all owl:Class in the EDAM_dev.owl file with for example wol:Class 🦉, and try to commit that change. The commit should fail now (returning 0), not allowing you to commit. (For comparison see Example 2 below)
  7. [If you have NOT done this in a new, experimental branch], reset the HEAD of your current branch (e.g. main) back to the last "proper" commit. (Hints: Reverting a commit is NOT the solution; git reset with correct parameters is the solution.)
  8. [If you HAVE done it in an experimental branch], please make sure that you don't continue doing your next, "real" changes into this branch.😉
  9. Did it work for you correctly like in the examples? Please post a comment to the issue if yes, thanks!😸 Did it not work for you? Please describe your problem as a comment to this issue and someone will help you!🆘

[a good small task for newcomers, e.g. Outreachy applicants]


Not sure how to start?


When this works, you're ready to edit EDAM locally! 👍🏽

(Note 1: There are also options to edit EDAM online, e.g. in Gitpod; and "Git-free" options to contribute with suggestions and comments in the NCBO BioPortal, WebProtégé, or suggest new concepts using an issue template. EDAM-bioimaging can also be editted directly in WebProtégé or on GitHub, details here.)

(Note 2: For someone who wants to script in Bash, or learn to, there is a very welcome possibility to improve the pre-commit script for better user experience.)

Uttam-Singhh commented 3 years ago

Hello @matuskalas, Can you assign this task to me. I have completed the task and faced no issue! Please check and let me know.

Lukong123 commented 3 years ago

Hello @matuskalas and other applicants please I need help i followed through the exercise and I am having a problem with line 6, I was able to commit, please do you know were I might have gone wrong?

Uttam-Singhh commented 3 years ago

I also replaced it successfully and was able to commit. But my test failed. so maybe you are not wrong anywhere. I think @matuskalas will guide properly on this.

drishya25 commented 3 years ago

Hey @Uttam-Singhh! I had followed till step 4. Can you please guide me on how and where you have completed step 5. Thank you!

Uttam-Singhh commented 3 years ago

Sure! @drishya25 Search in the project folder and open the file name "EDAM_dev.owl". Also, create a new branch by using - git checkout -b branch_name then in the file search "owl: Class" now select all occurrences and replace them with "wol: Class". Save the changes, then try to commit.

drishya25 commented 3 years ago

Thank you so much @Uttam-Singhh !

Lukong123 commented 3 years ago

I also replaced it successfully and was able to commit. But my test failed. so maybe you are not wrong anywhere. I think @matuskalas will guide properly on this.

Ok thanks

Uttam-Singhh commented 3 years ago

Anytime @drishya25 !

DankamT commented 3 years ago

I had thesame issue as @Lukong123, my test failed although I was able to commit. @matuskalas please can you guide us on this?

NonyeReeta commented 3 years ago

hi. can someone explain step 5 and step 6 to me? how do i do about it?

Lukong123 commented 3 years ago

Hello @Sweets-NI

Lukong123 commented 3 years ago

Hello please I need help in creating pull request for this issue, it keeps on showing nothing to compare entirely different commit history, I've tried troubleshooting it but I am still hook any idea @Uttam-Singhh , @matuskalas

Uttam-Singhh commented 3 years ago

Hello @Lukong123, Maybe you are in a different branch. Try changing your branch. If still, it doesn't work please check that the changes were successfully committed or not. Also, share a screenshot so that I can help more with this.

matuskalas commented 3 years ago

Apologies all for a very delayed answer.😟 And many thanks @Uttam-Singhh @Lukong123 for answering others' questions! 🙏🏽

I try to give some hints to all the problems reported. I try to answer everyone's problem there where I mention your GitHub "@" handle. However, I replied so that you can all read the whole long comment (I included examples to check out and compare with).

Editing the source file

@drishya25 @Sweets-NI This was answered by @Lukong123 and @Uttam-Singhh . How is going now further @drishya25 and @Sweets-NI?

@drishya25, you may need to fork this repository (at least I can't see any https://github.com/drishya25/edamontology). See links above in this issue if you need to read about it a bit more, or just press the Fork button on the top right of this page and carry on from there (Step 1.).

Please don't hesitate to ask for more help if needed! 🆘 We should be able to answer much faster from now on! 🐙

Example 1 (Step 5.)

When I create a new branch (in my case called experiment-with-pre-commit-hook) and do a trivial change (here changed the date), I can commit, and see that the commit is there (using git log):

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git diff
diff --git a/EDAM_dev.owl b/EDAM_dev.owl
index 5154ccd..1640555 100644
--- a/EDAM_dev.owl
+++ b/EDAM_dev.owl
@@ -14,7 +14,7 @@
      xmlns:oboOther="http://purl.obolibrary.org/obo/">
     <owl:Ontology rdf:about="http://edamontology.org">
         <next_id>4013</next_id>
-        <oboOther:date>23.02.2021 09:31 UTC</oboOther:date>
+        <oboOther:date>04.04.2021 16:04 UTC</oboOther:date>
         <oboOther:idspace>EDAM http://edamontology.org/ &quot;EDAM relations and concept properties&quot;</oboOther:idspace>
         <oboOther:idspace>EDAM_data http://edamontology.org/data_ &quot;EDAM types of data&quot;</oboOther:idspace>
         <oboOther:idspace>EDAM_format http://edamontology.org/format_ &quot;EDAM data formats&quot;</oboOther:idspace>

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git add EDAM_dev.owl

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git commit -m "Trivial change, updated date & time"
INFO: Pre-commit hook running from /c/Users/Matus/Work/edamOntology/edamontology
git version 2.29.2.windows.2
6955
[experiment-with-pre-commit-hook f3d8b28] Trivial change, updated date & time
 1 file changed, 1 insertion(+), 1 deletion(-)

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git log
commit f3d8b283fb0373e086f5d52e25f24bb9677ceb1f (HEAD)
Author: Matúš Kalaš <matus.kalas@uib.no>
Date:   Sun Apr 4 18:05:22 2021 +0200

    Trivial change, updated date & time

commit cc3a63e0e1a82ef121d55eefb688bfc3a1610a12 (origin/main, origin/HEAD, main)
Author: Matúš Kalaš <matus.kalas@uib.no>
...

Here the pre-commit script returned 6955 (you can find it above), so it succeeded.

Replacing all owls🦉

@DankamT You managed to fork, branch, and push your branch back, very nice!👍🏽😊 In your commit (https://github.com/DankamT/edamontology/commit/e2494d07e4f50c84d88f1f2e9d2ec7de94b891cc) I can see that you commented out one of the thousands of owl:Classes. Commenting out would not have stopped the validation script even if you commented out all (the script is very simplistic). Maybe it did work correctly and stopped you from another commit after you removed|replaced all the owl:Class strings? To be sure, please try more commits (Steps 5. and 6.), and see if the pre-commit script runs. And let us know how it worked for you 😉

Creating a branch and a pull request

@Lukong123

I am having a problem with line 6, I was able to commit, please do you know were I might have gone wrong?

...

Hello please I need help in creating pull request for this issue, it keeps on showing nothing to compare entirely different commit history

You managed to replace all owls with wols, and push it to https://github.com/Lukong123/edamontology/blob/first_branch/EDAM_dev.owl (that same in your master branch)👍🏽 The problem is, however, that you did this in an empty repository: Your commits (https://github.com/Lukong123/edamontology/commits/master) are not connected to ("branched from") the main branch (https://github.com/Lukong123/edamontology/commits/main), therefore it isn't possible to create a pull request and to merge. This is also a reason why you could commit in Step 6.: There is no .githooks/pre-commit script in your master==_firstbranch. Solution: Pull the main branch from https://github.com/Lukong123/edamontology.git if you haven't done so already. In any case, switch to it (git checkout main). Then please carry on starting with Step 3. Does this make sense? Do you need more help with it?

Problem in Step 6., it was possible to commit

For @Lukong123 answered right above. For @Uttam-Singhh answered in #621.

Example 2 (Step 6.)

When I replace all the owl:Classes with wol:Classes (in my branch experiment-with-pre-commit-hook), I cannot commit, as the pre-commit script returns 0. When I do git log, I see that the last commit is still my previous "Trivial change, updated date & time":

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git add EDAM_dev.owl

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git commit -m "Replaced all owls🦉 with wols🦉"
INFO: Pre-commit hook running from /c/Users/Matus/Work/edamOntology/edamontology
git version 2.29.2.windows.2
0

Matus@Rip MINGW64 ~/Work/edamOntology/edamontology (experiment-with-pre-commit-hook)
$ git log
commit f3d8b283fb0373e086f5d52e25f24bb9677ceb1f (HEAD)
Author: Matúš Kalaš <matus.kalas@uib.no>
Date:   Sun Apr 4 18:05:22 2021 +0200

    Trivial change, updated date & time

commit cc3a63e0e1a82ef121d55eefb688bfc3a1610a12 (origin/main, origin/HEAD, main)
Author: Matúš Kalaš <matus.kalas@uib.no>
...

Here the pre-commit script returned 0 (you can find it above), so it failed and stopped the commit.

This is the way it should work for everyone, in an ideal case. 😸

Please all, let us know how it worked for you, many thanks! 🙏🏽🙇🏽‍♂️

DankamT commented 3 years ago

Thanks @matuskalas, I repeated steps 5 and 6 and it returned 0 when I replaced all owl:class with wol:class Just a tip, if you are using sublimetext text editor, use the replace all function to replace all owl:class with wol:class and vice versa test612

matuskalas commented 3 years ago

Nice @DankamT! Does it also work for you this way when you try to commit?

crownie-hub commented 3 years ago

I have completed the task, it returned 0 when I tried to commit the changes ; replacing the owl:Class to wol:Class

leilayesufu commented 3 years ago

good day @matuskalas after replacing all my owl:Class with wol:Class, i could still commit and it returned 6955

DankamT commented 3 years ago

Hi @Leila, did you use the command "git add EDAM_dev.owl" before making changes to the EDAM_dev.owl file?

It tells git that you are about to make changes to the EDAM_dev.owl file. That way when you replace the owl classes with wol, it will be considered and the commit will fail. Please and let me know if it works for you

On Thu, 8 Apr 2021, 19:59 Leila Yesufu, @.***> wrote:

good day @matuskalas https://github.com/matuskalas after replacing all my owl:Class with wol:Class, i could still commit and it returned 6955

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/edamontology/edamontology/issues/616#issuecomment-816067611, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWAB6TURZFVCOOYFYXARPDTHX4KTANCNFSM42B354KA .

leilayesufu commented 3 years ago

Thank you very much

DankamT commented 3 years ago

You are welcome

On Fri, 9 Apr 2021, 02:56 Leila Yesufu, @.***> wrote:

Thank you very much

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/edamontology/edamontology/issues/616#issuecomment-816346417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWAB6UHHCPJCVPT6RYHL3TTHZNE3ANCNFSM42B354KA .

melibleq commented 3 years ago

All set up here!

Click for screenshot ![Captura de tela de 2021-04-12 00-03-23](https://user-images.githubusercontent.com/16723182/114335495-447aef00-9b23-11eb-9423-ac4eb135fa4d.png)
AnkitaxPriya commented 3 years ago

Hello @matuskalas I did all the necessary changes and currently, I'm trying to make a PR for my changes but unable to do so. Could you please guide me as to what might be a possible hindrance here? image

Jay-Fred31 commented 3 years ago

hello @matuskalas, I have done the first 4 steps of the guide. I am now on step 5 of creating a new branch and changing all occurrences of owl to wol, but I am unable to create a new branch. Please what am I doing wrong?

Screenshot 2021-04-12 at 07 35 25
Uttam-Singhh commented 3 years ago

Hello @AnkitaxPriya, If you did everything right you won't be able to commit those changes. In case your commit was successful, please check If you did something wrong.

Uttam-Singhh commented 3 years ago

Hello @Jay-Fred31, I think so it is not allowed to use whitespace in the branch name. Try using "-" or "_" instead of whitespace.

melibleq commented 3 years ago

Hey there @Jay-Fred31. I suppose the issue could be with the space and/or quotation marks (" "). These rules could also help you.

melibleq commented 3 years ago

@AnkitaxPriya have you used git push before the PR?

Jay-Fred31 commented 3 years ago

Thank you @Uttam-Singhh and @melibleq, I have sorted that out. Now trying to make an edit to commit, but the commit isn't working.

Screenshot 2021-04-12 at 08 46 13
Jay-Fred31 commented 3 years ago

I see where I made a mistake. I didn't add "-m" to my commit statement. All good now.

Jay-Fred31 commented 3 years ago

Hi @matuskalas, I think I am done with the task, kindly check this screenshot if it is all good. Also, if this is good. Kindly point me to what I should do next. Thank you

Screenshot 2021-04-12 at 09 06 47
matuskalas commented 3 years ago

Awesome, looks great @Jay-Fred31!

AnkitaxPriya commented 3 years ago

Hello @AnkitaxPriya, If you did everything right you won't be able to commit those changes. In case your commit was successful, please check If you did something wrong.

Thank you for the clarification @Uttam-Singhh There are many troubles coming up whenever I make any changes or whenever I am trying to make a PR. Maybe I should fork and clone the repo and start from scratch again.

AnkitaxPriya commented 3 years ago

@AnkitaxPriya have you used git push before the PR?

Yes I did make a push for one of the PRs I did previously.

Uttam-Singhh commented 3 years ago

Hello @AnkitaxPriya, If you did everything right you won't be able to commit those changes. In case your commit was successful, please check If you did something wrong.

Thank you for the clarification @Uttam-Singhh There are many troubles coming up whenever I make any changes or whenever I am trying to make a PR. Maybe I should fork and clone the repo and start from scratch again.

Okay great! @AnkitaxPriya The task is simple and straight you just need to follow the steps carefully. Just make sure your git version is updated(It plays an imp role). Let me know if you face an issue!

AnkitaxPriya commented 3 years ago

@Uttam-Singhh I don't understand why it is making a commit image

matuskalas commented 3 years ago

@Uttam-Singhh, thanks a lot for helping @AnkitaxPriya! 🙏🏽

@AnkitaxPriya, could you please:

AnkitaxPriya commented 3 years ago

@Uttam-Singhh, thanks a lot for helping @AnkitaxPriya! 🙏🏽

@AnkitaxPriya, could you please:

  • run .githooks/per-commit? It should show your Git version, and return 0 now that tou changed all owl:Class to wol:Class
  • set up git config core.hooksPath .githooks as written in the instructions

@matuskalas I have attached an image which shows the exact output I must get after running .githooks/pre-commit image

As you mentioned, I shouldn't be able to make a commit when changing owls:Class to wols:Class but I am able to make such a commit. image

Uttam-Singhh commented 3 years ago

@AnkitaxPriya Your git version needs to be 2.9.0 or higher for the hook to work. If you are using windows update your git by using the command - git update-git-for-windows

AnkitaxPriya commented 3 years ago

@AnkitaxPriya Your git version needs to be 2.9.0 or higher for the hook to work.

Thanks, Uttam-Singhh. I updated it even though it was higher than 2.9.0. :)

Well, I think that @matuskalas cleared my doubt. Initially when I ran .githooks/pre-commit I was retrieving the value 6955 but now after changing owl:class to wol:Class and making a commit (which was possible) and running .githooks/pre-commit again, I retrieved value 0.

Uttam-Singhh commented 3 years ago

@AnkitaxPriya Your git version needs to be 2.9.0 or higher for the hook to work.

Thanks, Uttam-Singhh. I updated it even though it was higher than 2.9.0. :)

Well, I think that @matuskalas cleared my doubt. Initially when I ran .githooks/pre-commit I was retrieving the value 6955 but now after changing owl:class to wol:Class and making a commit (which was possible) and running .githooks/pre-commit again, I retrieved value 0.

Oh Great!

Lukong123 commented 3 years ago

Hello @matuskalas , @Uttam-Singhh , @AnkitaxPriya and other applicants. please I am still finding difficulties with this issue well i had to go through the messages again and i found a difference between mentors code and mind please help me figure out where i went wrong my err teach own

Lukong123 commented 3 years ago

Hello @matuskalas , @Uttam-Singhh , @AnkitaxPriya and other applicants. please I am still finding difficulties with this issue well i had to go through the messages again and i found a difference between mentors code and mind please help me figure out where i went wrong my err teach own

I ran my first commit and it went without including pre-commit message as it is found in @matuskalas code please i really need help

matuskalas commented 3 years ago

@Lukong123, thanks for sharing the screenshots! Please run git config core.hooksPath .githooks in your local edamontology repo. Then try to commit again please.

AnkitaxPriya commented 3 years ago

Hello @matuskalas , @Uttam-Singhh , @AnkitaxPriya and other applicants. please I am still finding difficulties with this issue well i had to go through the messages again and i found a difference between mentors code and mind please help me figure out where i went wrong my err teach own

Please follow the steps mentioned below: Step 1 - Run git config .hooksPath .githooks Step 2 - Make some trivial changes in the EDAM_dev.owl file. Step 3 - Run git add EDAM_dev.owl Step 4 - run git commit -m "insert your commit message here"

I'm sure these steps will help. If not, do let me know about the error you are facing.

Lukong123 commented 3 years ago

Thanks @AnkitaxPriya but when i run git config .hooksPath .githooks i have this error eer2

matuskalas commented 3 years ago

Please write core.hooksPath

Uttam-Singhh commented 3 years ago

Hello @Lukong123 you can refer to this also, Everything is there including commands(you can copy-paste the commands to decrease errors)- https://github.com/edamontology/edamontology/blob/main/CONTRIBUTING.md#git-setup-on-your-local-machine

Lukong123 commented 3 years ago

Please write core.hooksPath

please @matuskalas it returns command not found

Lukong123 commented 3 years ago

Hello @Lukong123 you can refer to this also, Everything is there including commands(you can copy-paste the commands to decrease errors)- https://github.com/edamontology/edamontology/blob/main/CONTRIBUTING.md#git-setup-on-your-local-machine Thanks @Uttam-Singhh