Archive

Posts Tagged ‘GitHub’

Some notes on why and how to use a Version Control system like Git

Just recording here for posterity some comments I made on Delphi Deverloper Facebook group on the benefits and practice of using a Git repository on an online service like GitHub.

The idea with Version Control is that you can track changes, rollback easily to previous versions, if there are many contributors you can track which changes/lines they contributed etc. – e.g. see how GitHub diffs online (each Git client can use other diff tool) between the previous and newer version for a commit: https://github.com/…/03b0d7d20668a18b611dacf3134d0cdd5d…

Ideally you make commits often (a commit can contain changes to multiple files, ideally for just one feature/bug you were working on) and push them to the remote repo regularly (for extra safety/backup too), but usually when the code is buildable.

Some teams also spawn branches from the main branch in their repository (similar to forks, but those are for third parties usually to make a derivative of your whole repo) to work on experimental stuff and they merge them (and can get rid of those branches then) with the main branch when the feature/fix they were working on is ready. That way they also keep their main branch always buildable and working for testers and power users. Via automation sometimes they "continuously" (see CI / Continuous Integration) make latest/nightly builds from that main branch.

Also from that main branch they regularly make releases for the rest of the users when they’re confident enough the app/library/driver etc. they build is stable to release.

Even for small projects it’s worth setting up a Git repository (can even have pure local ones [for history tracking] with no remote) now that version control systems have nice visual clients without having to learn commands and use from the command-line. People also use them to track other artifacts like documentation, ideally text based artifacts, but there are diff tools that can compare binaries too (like images shown side by side with differences highlighted). There are some version contorl sytems specialized for non-text based artifacts, but Git can store versions of binaries too, even though it is textline-change focused.

The easiest way to use the Git repositories that GitHub offers for free (now backed by Microsoft so it will exist for years to come) is to install the GitHub Desktop app from their site (first you make a free account from their website). Then you can sync your local files to a public repository you make there (you commit updates to your local clone of the remote repository, then push the commits from the local clone to the remote repository). Others can make forks of that repository and work on their own versions and GitHub makes it easy to make pull requests (initiated by them or you) and merge changes from forks of your original repository into your own if/when you wish.

So it has the benefits of Git-based Version Control with extras too like optional Discussions, Wiki, Issue/Enhancement tracking, Milestones and Releases, Projects with Kanban boards and automated movement of tasks between columns on those boards etc.

There also other similar services like GitLab etc., but GitHub is probably the easiest to use and quite generous in offerings for OpenSource projects nowadays.

Categories: Posts Tags: , , ,