Alistair Ward
Member
- Location
- Christchurch, New Zealand
Here are some notes on using git, based on my experience. I'm going to cover a bit of higher-level workflows, the tools that I use and some detailed usage notes.
High level flow
A fairly common approach with git that I recommend is to use feature branches for all development.
The main idea of this is that the main branch is always good, releasable code. Any new feature is developed using a branch, and only when it has been tested on the branch (and is theoretically ready for release) is it merged to main
In a diagram, this might look like this:
This shows work being done simultaneously on 2 features, each branched from main.
feature1 is merged to main when it is ready.
feature2 branch is updated from main (this is the point where any conflicts are resolved), and can then be merged back to main.
Key notes:
I use and recommend:
For Templot-related work, I am currently using Araxis Merge (https://www.araxis.com/). It is normally horribly expensive, but they offer free licenses for contributors to open source projects.
I have seen some people at my work using kdiff3, and I find it rather ugly, and not the easiest to use.
I have not used WinMerge, so can't pass any judgement on that
I have not used GitHub desktop so I don't know what features it offers, or how it compares.
Forks and/or branching
For any repository in GitHub, only the Owner or Collaborators are allowed to directly write into repository.
Forking allows anybody (other Contributors) to suggest changes (ie create Pull Requests (PR's). A Fork is where anybody can create their own full copy of the repository, make changes, and then create Pull Requests back to the original repository. It is entirely up to the Owner/Collaborators of the original repo whether or not they accept the PR.
The Owner or Collaborators can push changes directly to a repo, either to main or to branches. As I suggested above, I think all new features should be pushed to a branch (within the repo), and then merged to main via a PR. There are branch protection rules that can be applied in GitHub to explicitly prevent people from pushing changes directly to main which should be enabled.
Quick summary: the Owner and Collaborators should create branches for new work, and merge those to main using PR's. Other Contributors should make a fork, and then submit PR's from that fork. Whether other Contributors use branches or not is not so important.
I'll add a follow-up post tomorrow with more detailed notes on how I use Git for Windows/Git Extensions to keep my local repo synced, create branches and push work to GitHub.
Alistair.
High level flow
A fairly common approach with git that I recommend is to use feature branches for all development.
The main idea of this is that the main branch is always good, releasable code. Any new feature is developed using a branch, and only when it has been tested on the branch (and is theoretically ready for release) is it merged to main
In a diagram, this might look like this:
This shows work being done simultaneously on 2 features, each branched from main.
feature1 is merged to main when it is ready.
feature2 branch is updated from main (this is the point where any conflicts are resolved), and can then be merged back to main.
Key notes:
- main should always in a "good" state
- any conflicts are resolved on the branch before merging back to main.
- the only commits in the main branch should be merges of completed features.
I use and recommend:
- Git for Windows - https://gitforwindows.org/
- Git Extensions - https://gitextensions.github.io/
- a good merging tool
For Templot-related work, I am currently using Araxis Merge (https://www.araxis.com/). It is normally horribly expensive, but they offer free licenses for contributors to open source projects.
I have seen some people at my work using kdiff3, and I find it rather ugly, and not the easiest to use.
I have not used WinMerge, so can't pass any judgement on that
I have not used GitHub desktop so I don't know what features it offers, or how it compares.
Forks and/or branching
For any repository in GitHub, only the Owner or Collaborators are allowed to directly write into repository.
Forking allows anybody (other Contributors) to suggest changes (ie create Pull Requests (PR's). A Fork is where anybody can create their own full copy of the repository, make changes, and then create Pull Requests back to the original repository. It is entirely up to the Owner/Collaborators of the original repo whether or not they accept the PR.
The Owner or Collaborators can push changes directly to a repo, either to main or to branches. As I suggested above, I think all new features should be pushed to a branch (within the repo), and then merged to main via a PR. There are branch protection rules that can be applied in GitHub to explicitly prevent people from pushing changes directly to main which should be enabled.
Quick summary: the Owner and Collaborators should create branches for new work, and merge those to main using PR's. Other Contributors should make a fork, and then submit PR's from that fork. Whether other Contributors use branches or not is not so important.
I'll add a follow-up post tomorrow with more detailed notes on how I use Git for Windows/Git Extensions to keep my local repo synced, create branches and push work to GitHub.
Alistair.
message ref: 12856