meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| wiki:version_control [2026/10/29 10:36] – created tmh | wiki:version_control [2026/11/02 09:33] (current) – [What is Github or a git forge?] minor edit tmh | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | # Version control guide | ||
| + | |||
| + | ## Video tutorial | ||
| + | After reading this quick guide, and learning the basic concepts, you can check out this [video tutorial](https:// | ||
| + | |||
| + | ## What is Git? | ||
| + | |||
| + | Git is a version control system. It means it can track differences in files and keep their history. It is most suited for tracking text files (including code), because the differences are easy to read and when a file has conflicting changes from multiple development tracks, these conflicts can be solved. However, it can also track binary files, like spreadsheets or images or anything else. | ||
| + | |||
| + | A **git repo** is a directory (" | ||
| + | |||
| + | One can work with git | ||
| + | - on the command line. For windows I recommend [git bash](https:// | ||
| + | - with graphical user interfaces. Git Gui comes bundeled with git bash in Git for Windows. One option is GitHub desktop, which has the downside of favoring github over other remote repositories and using confusing terminology which differs from actual git. Eg. [RStudio](https:// | ||
| + | |||
| + | It takes some effort to learn to use git effectively. I encourage to set aside a few hours to learn the basics of git on the command line. This will also make using git though a graphical interface much easier. The payoff is thousandfold in saved confusion and ease of working, trying out things, fixing things and collaborating. A good tutorial for beginners can be found [here](https:// | ||
| + | |||
| + | ## What is Github or a git forge? | ||
| + | Github is a hosting platform for **remote repositories**, | ||
| + | |||
| + | So far, Eurogreen and Fingreen are hosted on Github. New projects could benefit from using Codeberg, with a better free featureset and European ownership of the platform. In any case, it is easy to migrate a project from one host to another. | ||
| + | |||
| + | ## Guidelines for working with git effectively | ||
| + | There are many ways to organize work with git. What is suitable depends on the context. For our context, I think that a workflow called Github Flow is the best fit. | ||
| + | |||
| + | ### Github Flow | ||
| + | This branching strategy has nothing to do with Github specifically, | ||
| + | 1. The `main` branch is where a working version of the model always lives. | ||
| + | 2. Any new features or changes are worked on separate feature branches, eg. `feature/ | ||
| + | 3. Small changes/ | ||
| + | |||
| + | ### Pull-requests | ||
| + | Instead of just pushing our changes directly into main, it is usually a good idea to open pull requests instead. They could actually be called merge requests, because the idea is to merge some changes from one branch into another. A pull request can be viewed and commented in Github, and it is a good idea to have another developer review the changes. This encourages better quality and compliance with common guidelines, improves catching bugs early, and the team is better kept up to date on what is going on in the model. Creating a pull request is covered in the [video tutorial](..wiki: | ||
| + | |||
| + | ### Resolving conflicts | ||
| + | Conflicts can arise if we try to merge or rebase our changes with someone else's changes: both modified the same file and now git does not know how to combine the changes or which one to prefer. A basic example of conflict resolution is shown in the [video tutorial](..wiki: | ||
| + | |||
| + | ### Ignoring files | ||
| Upcoming | Upcoming | ||
| + | |||
| + | |||
| + | ### When to commit and how to write a good commit message? | ||
| + | Usually, it is better to commit often rather than sparsely. One rule of thumb is to commit whenever you make some kind of a " | ||
| + | |||
| + | A commit message should state in concise imperative form what change it implements. Do: | ||
| + | ```bash | ||
| + | # Do: | ||
| + | git commit -m " | ||
| + | ## Do NOT: | ||
| + | git commit -m " | ||
| + | ## also don't | ||
| + | git commit -m "some work" | ||
| + | # also don't | ||
| + | git commit -m "I wrote here a full novel describing everything: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." | ||
| + | ``` | ||
| + | |||