From b68d49940921322607c689230fbfa20b8a078a6b Mon Sep 17 00:00:00 2001 From: daviditschan Date: Tue, 9 Jun 2026 10:45:07 +0200 Subject: [PATCH] First changes to markdown file README.md to include information on git workflow and conda environments --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index e69de29..674f66e 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,40 @@ +# Welcome! + +Hello! This is the read-me file with some important information for the code project. + +# Coding help +## Conda +Extensive documentation is available on [docs.conda.io](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html). +1. Get info on conda environments: `conda info --envs` or `conda env list`; +2. Create new conda environments: `conda create --name ` where `` is replaced with the name; Additional flags include `python=3.0.0` indicating the python version; +3. Creating an environment from a `.yaml` file: `conda create --name --file path/to/file/environment.yaml`, or navigate directly to the good location via `cd path/to/file`; +4. Exporting a python environment to a `.yml` file: `conda env export --name --format=environment-yaml --file=environment.yaml`; +5. Updating an environment: `conda env update --file environment.yaml --prune`, where `--prune` removes any unused dependencies; +6. Activating a conda environment: `conda activate `; +7. Deactivate an environment: `conda deactivate`; +8. List packages in environment: if the environment is not activated, run `conda list -n `, else (if it is activated) run `conda list`; +9. Add a channel: `conda config --prepend channels new_channel` to add a channel to top of the channel list, or run `conda config --append channels new_channel` to append a channel to the bottom of the channel list; +10. Installing packages: `conda install --name numpy scipy ...` to install packages `numpy`, `scipy` etc. into the environment ``; Package versions may be specified like this `numpy=3.4.2`; +11. Update packages: run `conda update --name package` to update `package` in ``; updating python is `conda update python` and updating conda itself is `conda update conda`; +12. Pinning a package: add a file named `pinned` to the `conda-meta` directory of the enviornment, and add the following lines to the file `package 1.7.*` to restrict the package to remain in the `1.7` series, or `package==1.5.4` to force the package to remain at exactly the specified version; The pinning may be overrun by `conda update package --no-pin`. +13. Remove package: `conda remove -n package` to remove `package` from ``; + +## Git +This ensures that there is a connection to the psi network, use the vpn domain `vpn.psi.ch`. +1. Add the private key to the ssh agent via the following snippet on mac +``` +eval "$(ssh-agent -s)" +ssh-add ~/.ssh/ +ssh -T git@gitea.psi.ch +``` +or windows + +``` +eval "$(ssh-agent -s)" +ssh-add ~/.ssh/ +ssh -T git@gitea.psi.ch +``` +2. To create a local repository, clone the remote one via `git clone git@gitea.psi.ch:tschan_d/Master_Thesis.git`. This command creates a new local folder named `repo`, initialises a git repo within it, a remote named `origin` is created, pointing to the connected server, all of the files and and commits are downloaded and the default branch is checked out. +3. Use `git fetch git@gitea.psi.ch:tschan_d/Master_Thesis.git` to retrieve new work on the remote, without merging everything into the local branches. +4. use `git merge REMOTE-NAME/BRANCH-NAME` to merge a remote branch with the local branch. +5. Steps 3 and 4 may be executed more succinctly via `git pull REMOTE-NAME BRANCH-NAME` to grab online updates and merge them into the local branches. \ No newline at end of file