GitHub MJFF Community, tips and tricks

We have a number of ongoing projects in the MJFF Research Community GitHub that are being generated by the Data Modalities and Methodologies Task Force. We want this resource to keep growing, so I thought I’d highlight some useful GitHub resources and encourage more people to come over and contribute!

For a simple of how git and version control works, there’s this guide to git, which is a nice simple overview as compared to the detailed git documentation on GitHub’s website.

I like to integrate my GitHub repos with VSCode. It has some nice tracking features, and will even make source control graphs so that you can picture changes to a project. For example, here is what it looks like on my fork of @danieltds Usefull PPMI Clinical Codes repo before my commits were merged:

And after my commits were merged:

Another useful “trick” in GitHub is to use your .gitignore file to ignore folders containing sensitive data (patient data, data requiting access agreements, etc.). @hirotaka has a repo on the MJFF Community page that demonstrates how to set up a project this way, with a test file in the data folder that you can use to make sure that the data doesn’t accidentally get uploaded to GitHub. @danieltds implemented this structure in the Useful PPMI Clinical Codes repo. It is a nice example of putting source data downloaded from LONI in a data folder, with instructions in the .gitignore not to upload any files in the data folder. That way code can be shared without also sharing protected data.

I won’t link to them here, but there are news stories in the tech community from time to time of people not using .gitignore properly and accidentally releasing private information. Don’t be that person!

Does anyone else have some GitHub tips or tricks they would like to share?

2 Likes

Great post @ehutchins! I really enjoy Github Actions. You can program GitHub to perform actions automatically after pushes are made to repos.

For instance, the Open Science Guide is written using quarto. Once changes are pushed and merged into the main branch, GitHub automatically builds the book from scratch and re-creates the HTML files for the website. This facilitates collaboration, as there is just one main branch and HTML files do not need to be pushed to GitHub with every edit.

Instructions to do this using quarto can be found here and a live use case for the Open Science Guide can be found here.

2 Likes

Thanks @mattk ! That’s a great example. Super neat that the HTML pages are automatically re-created!

2 Likes

Great summary, @ehutchins! I wasn’t aware of VSCode’s GitHub commit visualization—very cool. And since I work with @mattk for the open-science-guide project, I’ve also learned about GitHub Actions, which is indeed a great feature.
Git is necessary, but it doesn’t feel second nature to me yet. I still rely on ChatGPT to help me figure out the right commands for what I need to do—they make a great companion!

3 Likes

@hirotaka GitHub Actions are a good one! I’ve found tools like ChatGPT and VS Code integration can be great companion tools (along with the GitHub docs of course) for helping to remember the right commands to use.

2 Likes