Delete the remote branch of the MATLAB project(Project used with MATLAB git)

5 views (last 30 days)
Version:MATLAB 2020b
Background:I found that in the MATLABgit project of 2020b, it is impossible to delete the branch of the remote repository. After querying the document, it is found in the 2024a version, there is a discardChanges (repo,files) function to achieve this function. Is there any way to achieve this function in the 202b version?
Even if I choose to delete the remote branch in the branch browser, I still get the remote branch I don't want every time I pull it back。

Answers (1)

Shivani
Shivani on 18 Jun 2024
Hello @鸿彬
The function 'discardChanges' was introduced only in MATLAB R2024a and therefore you won't be able to access it in the previous releases. You can refer to the following MATLAB documentation page for more details on this: https://www.mathworks.com/help/matlab/ref/matlab.git.gitrepository.discardchanges.html#:~:text=Introduced%20in%20R2024a
However, you can prevent this behavior in MATLAB R2020b by configuring Git to prune remote removed branches by default. You can do so by running the following command in the MATLAB command prompt during the setup of Git Source Control:
!git config remote.origin.prune true
You can view this MATLAB documentation link for more information on setting up Git control: https://www.mathworks.com/help/matlab/matlab_prog/set-up-git-source-control.html

Categories

Find more on Source Control in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!