Workflow Matlab with Git
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
2 Comments
Share a link to this comment
Share a link to this comment
Accepted Answer
1 vote
Share a link to this answer
- You want to work on two independent features. You can create a branch for each feature, and then when the feature is done you can merge it back into the main branch.
- You want to apply bug fixes to a past release, without incorporating all the new features into the past release. You create a branch based on the release (you can create a new branch from a git tag), and apply the fix to just that branch.
- You are working in a team.
- https://launchdarkly.com/blog/git-branching-strategies-vs-trunk-based-development/
- https://medium.com/@patrickporto/4-branching-workflows-for-git-30d0aaee7bf
- https://www.atlassian.com/agile/software-development/branching
- https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow
- https://www.atlassian.com/git/tutorials/comparing-workflows
15 Comments
Share a link to this comment
Share a link to this comment
- You start with a local git repository that exists exclusively in your working directory.
- You create a "bare repository", either in a separate folder, or on a hosting service like GitHub. This repository starts with no history and no files.
- You link your working directory with the bare repository using "git remote". Note that when you first create a new GitHub (or GitLab) repository, it prominently shows you exactly what code to run to complete this step, customized for your specific repository.
- You "git push" from your local repository into the new central repository.
- You use "git clone" to create the second working directory. When you use "git clone" the repository is already linked to the central repository that you cloned from.
- You start with a local git repository that exists exclusively in your working directory.
- You then run "git clone" to create a new repository based on the working directory.
- Every example should have an associated test that runs the example against the current code base. You can take a look at the MATLAB Unit Test Framework for how to write MATLAB based tests.
- When you start working on a new feature (not a new release, but a new feature) you create a new git branch (a "feature branch") for that new feature. A feature can be very small (one new input argument) or large (completely rewriting an entire function), that part is up to you.
- As you develop the feature, before each commit you run the tests, if any of them fail you update the corresponding example immediately, so that each commit has examples that are consistent with the current code base.
- Once the feature is done being developed, you can add any additional examples (and any corresponding tests) and commit those to the feature branch.
- Once you are satisfied with the feature, you merge that feature branch back into the main branch.
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
More Answers (0)
Categories
Find more on Git in MATLAB in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)