This page aims to consolidate some tips and tricks that ontology editors have found useful in using
git. It is not meant to be a tutorial of
git, but rather as a page with tips that could help in certain specialised situations.
Reverting particular files back to master version¶
- If you want to revert only certain files (eg import files), you can do it using Terminal. For this example, we will use uberon_import.owl as the file we want reverted back to the version in master branch, however, this can be done on any file.
- Assuming your directory is set to
src/ontology, in terminal use:
git checkout master -- imports/uberon_import.owl.
- Commit the change to the branch as normal.
Reverting particular files back to a previous version¶
- If you want to revert a file back to a previous version instead of master, you can use the commit ID.
- To do this, in Terminal use:
git logto list out the previous commits and copy the commit code of the commit you would like to revert to (example: see yellow string of text in screenshot below).
- Press q on your keyboard to quit git log (or down arrow to scroll down to continue to find the commit ID you want to revert if it is further down).
- In terminal use:
git checkout ff18c9482035062bbbbb27aaeb50e658298fb635 -- imports/uberon_import.owlusing whichever commit code you want instead of the commit code in this example.
- commit the change to the branch as normal.