RSH 25: Intro to GitHub
What is GitHub and why would you use it?
Video
Collaborative notes taken during the session
Intro to GitHub
This event was put on with support of the Aalto Research Services
open science
team.
Progression of use cases and topics
GitHub is used for:
- things for yourself (central location, backup, sharing, organizing, easy moving to later levels)
- things for small groups (organizations, shared repos with or without PRs, etc)
- things for community (outside collaborators, discussion, PRs, etc)
Where are you? Where do you want to be?
Quick survey
I have used git before:
- yes: IoooooOooooIoooo
- no: Ooooooo0oooo
In the past I have already opened an issue on GitHub:
- yes: oIIoooIII
- no: OoOoooooooooooooo0ooo
In the past I have already creaded a pull request on GitHub (or merge request on GitLab):
- yes: ooooIooIo
- no: oOooooooooooooooo
What is git?
- Version control
- Track changes
- Inspect history
- Work together
- Basically a requirement for any kind of serious programming work
- But also useful for others.
- This talk is not about git: we assume you use it already
- tracks code, manuscripts, theses, etc.
Example: https://github.com/bast/pr-exercise
What is GitHub?
- Commercial company
- ... hosting a web repository, GitHub
- Very good free services for open-source projects.
- vs Gitlab
- Gitlab is open-source equivalent
- Many universities have their own (e.g. version.aalto.fi, source.coderefinery.org)
- For the most part, usage is the same.
- Interfaces: take your pick
- Git command line
- GitHub desktop and apps
- GitHub web interface
- Cost
- GitHub ownership
Question: Are there command line interfaces for GitHub that work on Windows?
- For git itself, Git for Windows. / gitbash https://gitforwindows.org/
- https://cli.github.com/
- This has some nice extra features (not just for Windows btw)
I don't know if it's changed, but last time I checked, the GitHub Desktop was pretty unstable in Windows.
Basic features: pushing and pulling
Let's demo the basics of GitHub.
- You connect to other servers via git remotes, controlled with
git remote
.
- Once a remote is set, you
git push
, git fetch
, and git pull
- It isn't our goal to go in detail about the technical implementation: you can read this later. (we'll talk about why instead)
Quick demo:
- New repository
- Create repository on GitHub
- Add remote
- Push to GitHub
demo commands:
- git log
- git remote -v
- git push origin master
Git for small groups
- The next level is using GitHub among a research group, or something similarly small.
- To be a group, you need to work together. To work together, you need a place to do so.
- Organizations
- User management: share among a group
- Issues: Track things to do
- Pull requests: Code review
Question: I work with Jupyter Nitebooks. Is there an easy way to integrate those into github? thanks
- great question! I use this locally (nice tool to visually diff and merge notebooks): https://nbdime.readthedocs.io/ but I don't know of a good way to see nice diffs directly on GitHub. I anticipate that GitHub is working on that. Anybody knows some solution?
- Yeah, diffs not so good right now. I haven't heard of much beyond that, but many people do use git for notebooks, just realize that diffing and merging isn't so easy.
- the nbdime is great locally for this but would be nice to see it directly in pull requests +1
- So you have your own group working well. What comes next? The community
- There is little cost to accepting contributions from others.
- Minimizing information overload in big community projects.
Important considerations
- Importance of a license file
- Don't accept contributions until you get this clarified
- How to contribute
- Issue templates, pull request templates, etc.
- Code of conduct
Comment:
- It's actually important that issues are not generally viewed as "problems" but more as improvement ideas, etc. cause otherwise some people tend to try to avoid having issues listed.
Long term: archiving and Zenodo
- GitHub is the de-facto source for open research software (for better or for worse)
- Can you cite it in a paper?
- Can you expect GitHub to be around in 20 years?
- More likely than your university's Gitlab or personal webpage. (But does your user still exist?)
- For permanent storage, connect to Zenodo and publish releases.
- Zenodo is a EU-funded repository of science.
Video demo of Zenodo link: https://www.youtube.com/watch?v=Atp-GmhS7gY
Actions
- GitHub Actions are continuous integration: they can run tests on every commit.
- Automatic testing on changes: great for making sure things work!
- Automatic deployment, for example push to git and a website gets updated.
What's next?
- CodeRefinery courses: https://coderefinery.org/lessons/
- git-intro (by yourself)
- git-collaborative (GitHub + pull requsets)
- Automated testing: GitHub Actions
- Research Software Hour: https://researchsoftwarehour.github.io/
- Aalto Research Software Engineers: https://scicomp.aalto.fi/rse/
- Coderefinery chat: https://coderefinery.zulipchat.com/
Feedback
One good thing about today:
- The demos were helpful! Thank you!
- Great introduction! Thank you!
- .
- .
- .
One thing to be improved: