Lab Upstream Workflow (SourceTree)
This guide is for labs that want to modify ScanImage source code for their own purposes while still receiving official bugfixes and new releases from Vidrio. It uses Git’s concept of a remote named upstream to keep the two separate.
This version of the guide uses SourceTree as the Git interface. If you prefer working in a terminal, see Lab Upstream Workflow.
When You Need This
The default workflow — checking out a minor/{version} branch and pulling — is ideal for most labs. You get bugfixes automatically and everything stays synchronized with the official release.
You need the upstream workflow when:
You want to modify ScanImage source files (e.g. custom acquisition modes, altered UI panels, lab-specific hardware drivers)
You need those modifications to persist across bugfix updates
You want different lab members to independently manage their own version of these customizations
Concept
[vidriotech/scanimage-*-releases] ← upstream (read-only, official)
|
| Fetch from upstream
↓
[Your private repo or local branch] ← origin (your lab's customizations)
|
| each lab member clones this
↓
[Individual member's working clone] ← on their machine, on their MATLAB path
Your private repository holds your customizations. The official releases repository is the upstream source of truth. You merge upstream fixes into your lab repo on your own schedule.
Setup
Option A — Start fresh from this repository (recommended)
Step 1 — Clone the release repository
Open SourceTree. On the main screen, click Clone.
In the Source Path / URL field, enter your release repository URL with credentials embedded:
https://<username>:<token>@gitlab.com/vidriotech/scanimage-basic-releases.git
Set the Destination Path to where you want the folder on your machine (e.g.
C:\Users\you\scanimage-lab).Set the Name field to
scanimage-lab(or your preferred folder name).Click Clone.
Step 2 — Rename the ‘origin’ remote to ‘upstream’
With the repository open in SourceTree, go to Repository > Repository Settings.
Click the Remotes tab.
Select the remote named
originand click Edit.Change the Remote Name field from
origintoupstream. Leave the URL unchanged.Click OK, then OK again to close settings.
Step 3 — Create a local bare repository to act as your lab’s private remote
A local bare repository acts like a private server on your machine or a shared network drive — no GitLab or GitHub account is required.
Note
This step requires SourceTree’s built-in terminal. Click the Terminal button (>_) in the SourceTree toolbar to open it.
In the terminal, run:
git init --bare /path/to/your/lab-scanimage.git
Replace /path/to/your/lab-scanimage.git with the actual folder path (e.g. C:/Users/you/lab-repos/lab-scanimage.git, or a path on a shared network drive so all lab members can reach it). Then close the terminal and continue in SourceTree:
Go to Repository > Repository Settings > Remotes.
Click Add.
Set Remote Name to
origin.Set URL / Path to the same path you used above.
Click OK.
Note
- What does it mean to have a local bare repository as your remote?
It stores your full commit history and can be pushed to and pulled from just like a remote server, but lives entirely on your local machine or a shared network drive without duplicating storage of all of the source files to that location (bare). No GitHub or GitLab account is needed. If your lab members share a network drive, point the path there so everyone can clone from the same location.
Alternative: Use a remote private repository (GitLab/GitHub)
If your lab requires access from multiple machines that do not share a network drive, you can host your private repository on GitLab or GitHub instead.
Create an empty private repository on GitLab or GitHub first, then in SourceTree:
Go to Repository > Repository Settings > Remotes.
Click Add.
Set Remote Name to
origin.Set URL / Path to your private repository URL (e.g.
https://gitlab.com/<your-org>/<your-repo>.git).Click OK.
Warning
License compliance — Your ScanImage license is granted to your lab only. Do not make this repository public, and do not share access with anyone who has not purchased a ScanImage license. Sharing ScanImage source code with unlicensed users — even indirectly through a repository — violates your license agreement. Keep the repository strictly private and limit access to licensed members of your lab.
Tip
Interested in sharing your customizations with the ScanImage community? If your lab has developed extensions or modifications to ScanImage that you believe would benefit other users, reach out to us at support@mbfbioscience.com. We review community contributions and may be able to host your customized version directly in our official releases repository, making it available to all licensed ScanImage users in a way that is fully compliant with the license terms.
Step 4 — Push to your local bare repository
Click the Push button in the SourceTree toolbar.
Select
originas the remote.Check the box next to main to push that branch.
Click Push.
Step 5 — Create your lab’s customization branch
Click the Branch button in the SourceTree toolbar.
Name the branch
lab/<labname>/custom(e.g.lab/bhatt/custom).Ensure Checkout New Branch is checked.
Click Create Branch.
Click Push, select
origin, check your new branch, and click Push.
Option B — You already have a clone and want to add this repo as upstream
Open your existing local clone in SourceTree.
Go to Repository > Repository Settings > Remotes.
Click Add.
Set Remote Name to
upstream.Set URL / Path to your release repository URL with credentials:
https://<username>:<token>@gitlab.com/vidriotech/scanimage-basic-releases.git
Click OK.
Click the Fetch button in the toolbar. Check Fetch from all remotes and click OK.
Making Lab-Specific Customizations
Work on your lab/<labname>/custom branch. To commit and push changes:
In the File Status panel, modified files appear under Unstaged Files.
Check the box next to each file you want to include, or click Stage All.
Enter a commit message in the text box at the bottom.
Click Commit.
Click Push to send your commits to
origin.
Practical tip: Where possible, keep your customizations in separate files from core ScanImage files. If your changes live in new files (e.g. +lab/myCustomPlugin.m) rather than edits inside existing ScanImage files, merging upstream bugfixes will rarely produce conflicts.
Receiving Official Bugfixes and New Releases
When Vidrio pushes a fix to minor/{version} or a new major release to main, bring it into your lab branch:
Fetch from upstream: Click the Fetch button, check Fetch from all remotes (or select just
upstream), and click OK. This downloads the latest from Vidrio without changing any of your files yet.Check out your lab branch: In the left sidebar under Branches, double-click
lab/<labname>/customto check it out.Merge the upstream patch branch:
In the left sidebar under Remotes > upstream, find the branch you want (e.g.
minor/2023b).Right-click it and select Merge upstream/minor/2023b into current branch.
If there are no conflicts, the merge completes automatically.
If there are conflicts, SourceTree highlights them in the File Status panel. Right-click a conflicted file and choose Resolve Conflicts to open your merge tool, or fix the file manually and then right-click and choose Mark Resolved.
Push to origin: Click Push, select
origin, check your lab branch, and click Push.
Each lab member then pulls from origin to receive both the upstream fix and any lab customizations:
Check out the lab branch by double-clicking it in the left sidebar.
Click Pull. SourceTree will pull from
originby default.
Multi-Member Lab Workflow
Each lab member maintains their own clone of your private repository on their own machine. To set up a new member:
Open SourceTree and click Clone.
In Source Path / URL, enter the path to the shared bare repository (e.g.
\\networkdrive\lab-repos\lab-scanimage.git) or the HTTPS URL if using GitLab/GitHub.Set the Destination Path to where they want ScanImage on their machine.
Click Clone.
In the left sidebar, find
lab/<labname>/customunder Remotes > origin. Double-click it to check it out as a local branch.Add the ScanImage folder to their MATLAB path.
Because each person’s clone is on their own machine, one member modifying source code does not affect any other member’s running instance. Members who do not want any customizations can simply check out the official minor/{version} branch directly from upstream instead.
Caveats
Merge conflicts: SourceTree highlights conflicted files in the File Status panel with a warning icon. Right-click a conflicted file to open it in your configured merge tool, or edit it manually and then right-click and choose Mark Resolved. This is uncommon if you keep customizations in separate files.
Storage: Your private repository stores only your commits on top of the official history. It does not duplicate the full ScanImage history unless you push the entire branch history to your private repo, which is normal and expected.
Access tokens: If your Vidrio deploy token is renewed, go to Repository > Repository Settings > Remotes, select
upstream, click Edit, and update the URL with your new token.