github_repositories_of_the_lab
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| github_repositories_of_the_lab [2024/08/09 11:05] – 134.190.232.164 | github_repositories_of_the_lab [2024/08/13 11:26] (current) – [Saving changes as commits] 134.190.232.164 | ||
|---|---|---|---|
| Line 29: | Line 29: | ||
| The [[ https:// | The [[ https:// | ||
| - | ==== Interacting with the repositories ==== | + | ===== Interacting with the repositories |
| + | |||
| + | ==== Cloning a repository | ||
| To have access to all the scripts and other files in a repository on your local machine (your laptop, PC, MAC, etc), do the following: | To have access to all the scripts and other files in a repository on your local machine (your laptop, PC, MAC, etc), do the following: | ||
| Line 48: | Line 50: | ||
| ==== Saving changes as " | ==== Saving changes as " | ||
| + | |||
| + | Let's say you have edited one of the scripts in the repository and you wish your version of the script to overwrite the current version of the script in the repo. We can do this! | ||
| + | |||
| + | Before anything else, it's good practice to run '' | ||
| + | |||
| + | If we we're already working on the latest version, we see | ||
| + | |||
| + | < | ||
| + | Already up to date. | ||
| + | </ | ||
| + | |||
| + | and we're good to go. | ||
| + | |||
| + | If not, you may something along the lines of | ||
| + | |||
| + | < | ||
| + | remote: Enumerating objects: 9, done. | ||
| + | remote: Counting objects: 100% (9/9), done. | ||
| + | remote: Compressing objects: 100% (3/3), done. | ||
| + | remote: Total 6 (delta 4), reused 5 (delta 3), pack-reused 0 | ||
| + | Unpacking objects: 100% (6/6), done. | ||
| + | From github.com: | ||
| + | | ||
| + | Updating cf52972..f843408 | ||
| + | Fast-forward | ||
| + | | ||
| + | 1 file changed, 69 insertions(+), | ||
| + | </ | ||
| + | |||
| + | It tells us in this case that the find_polyA_sites.py script was modified in the last commit or commits that were lacking in our local copy of the main branch, and that our local copy is now updated with those changes. We're good to go. | ||
| + | |||
| + | Now, let's run '' | ||
| + | This git command is extremely useful and will always give you a nice overview of the current status of the repo. It is probably the git command I use the most. Here is an example output: | ||
| + | |||
| + | < | ||
| + | On branch main | ||
| + | Your branch is up to date with ' | ||
| + | |||
| + | Changes not staged for commit: | ||
| + | (use "git add < | ||
| + | (use "git restore < | ||
| + | modified: | ||
| + | |||
| + | no changes added to commit (use "git add" and/or "git commit -a") | ||
| + | </ | ||
| + | |||
| + | Our current " | ||
| + | |||
| + | " | ||
| + | |||
| + | Then we see that the '' | ||
| + | |||
| + | < | ||
| + | diff --git a/ | ||
| + | index 9929356..a284b17 100755 | ||
| + | --- a/ | ||
| + | +++ b/ | ||
| + | @@ -11,7 +11,7 @@ import sys | ||
| + | # make command line interface | ||
| + | | ||
| + | | ||
| + | - Roots with outgroup defined in the mapping file""" | ||
| + | + Roots at midpoint""" | ||
| + | ) | ||
| + | | ||
| + | " | ||
| + | </ | ||
| + | |||
| + | It shows that in our edit, the line indicated with '' | ||
| + | The lines above and below that merely show the context, to help identify where in the file the changes were made. | ||
| + | |||
| + | If we are OK with these changes, we can now " | ||
| + | |||
| + | < | ||
| + | git add sketch_tree.py | ||
| + | </ | ||
| + | |||
| + | With '' | ||
| + | |||
| + | < | ||
| + | git commit -m " | ||
| + | </ | ||
| + | |||
| + | The text in the quotes is our **commit message**. Its a brief description of our commit, which will help us understand the reason for the change if we ever decide to go back and check out git commit history. | ||
| + | |||
| + | We see an output like this | ||
| + | |||
| + | < | ||
| + | [main f843408] rooting at midpoint, not with outgroup | ||
| + | 1 file changed, 1 insertion(+), | ||
| + | </ | ||
| + | |||
| + | It informs us that the " | ||
| + | |||
| + | Our local " | ||
| + | |||
| + | < | ||
| + | Enumerating objects: 5, done. | ||
| + | Counting objects: 100% (5/5), done. | ||
| + | Delta compression using up to 8 threads | ||
| + | Compressing objects: 100% (3/3), done. | ||
| + | Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done. | ||
| + | Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 | ||
| + | remote: Resolving deltas: 100% (2/2), completed with 2 local objects. | ||
| + | To github.com: | ||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | A succesfull push! If you check the online GitHub repository now in your internet browser, the file should be updated! | ||
| + | |||
| + | You should now be familiar with the basics of interacting with a GitHub repository. Using git can be far more advanced, with different branches, re-basing etc etc but I'd say for 99% of our usecases this should suffice. | ||
| + | |||
| + | ==== Deleting a repository ==== | ||
| + | |||
| + | Deleting a local copy of your repository is as easy as removing the folder that contains the repository. | ||
| + | |||
| + | For example | ||
| + | |||
| + | < | ||
| + | rm -r gospel_of_andrew | ||
| + | </ | ||
| + | |||
| + | Easy peasy! | ||
github_repositories_of_the_lab.1723212350.txt.gz · Last modified: by 134.190.232.164
