-
Notifications
You must be signed in to change notification settings - Fork 11
Github basics
If you are new to github, you might have problems on learning how to use git. To understand the basics, you should be a bit learning by doing (the best kind of learning imo). For that, make your own github project following this Tutorial. If you have a lot of time and interest, you can master the other aspects of github at this Quickstart site. Another neat introduction on how to make a proper repository is Scientific Python Cookiecutter
If you don't have a lot of time, here are some essential commands, you will need to work with the EDIBLES repository.
git clone https://github.com/jancami/edibles.git
With this command you download the EDIBLES repository. Essentially you get a full copy of the repository.
git switch -c branch_name --track origin/branch_name
The "-c" indicates to create a new local branch, which tracks the same named online branch. You need this command to switch to another remote branch. By default (when you cloned the repository), you are on the master branch. The master branch should always work and is usually protected from being altered by anyone else than the project owner.
It might happen that you found a bug and a fix was pushed on the github. You can overwrite your local branch by first resetting it to the last commit:
git reset --hard HEAD
, and then pulling the latest commit:
git pull
ssh-keygen -t ed25519 -C "<comment>"
To push your local project, it is best to use an ssh key, so github know it can trust your computer. The key is saved by default in "~/.ssh/id_ed25519.pub". You have to copy the key into the list of trusted keys of your github account (In your account settings under "SSH and GPG keys").