web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Code merges in Visual Studio changeset cleanup

(8) ShareShare
ReportReport
Posted on by 307
We use daily pipelines running from a Dev branch to build code based on the day’s check ins. 
We have a Main branch to which changesets are merged from the Dev branch, done in Visual Studio using Source Control Explorer (TFVC, not Git).

I’ve recently deployed an ISV from a vendor that was not properly checked.  The packages received from the vendors was build on development environments (not pipelines).  I don’t have control over the vendors processes due to politics on the project. 

This means that I checked in multiple deletions and deployments of the ISV  to the Dev branch, which means multiple changesets.  These changesets will never get merged to higher branches.
Is there any way to cleanup unnecessary changesets which will never be merged, from the list of available changesets when merging from Dev to Main branches?
 
Categories:
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at
    You can use tf merge /discard on command line (you can easily find more details about it on internet, e.g. How To Remove A Merge Candidate From The Merge Tool in Visual Studio). I sometimes used it in the past. It's good to fix these things ASAP, before it becomes a mess. An alternative is actually merging everything (all the deletions etc.), although you're really interested just in the final state.
  • Suggested answer
    Sahan Hasitha Profile Picture
    2,683 on at
    hi
     
    In your setup with TFVC, daily builds are triggered from the Dev branch, and changes are merged into Main via Source Control Explorer. After deploying an ISV package built outside your pipelines, several unwanted deletions and deployments were checked into Dev, resulting in multiple changesets that should never be merged to higher branches. Unfortunately, TFVC does not allow permanent deletion of changesets once committed. However, you can prevent them from appearing in merges by performing a baseless merge or using cherry-pick merges to only bring the valid changesets forward. Another option is to mark the unwanted changesets as merged without actually merging their content, ensuring they no longer appear in the pending merge list. This way, you avoid polluting your Main branch while keeping the Dev history intact.
  • Suggested answer
    Nimsara Jayathilaka. Profile Picture
    5,128 Super User 2026 Season 1 on at
    To clean up unnecessary changesets in TFVC so they don’t appear as merge candidates from Dev to Main branch:
     
    1. Use the command: tf merge /discard /version:C123~C130 DevBranch MainBranch /recursive to discard changesets 123 to 130 from merge candidates.
    2. This updates merge history without applying the changes.
    3. Check in the pending merge to finalize the discard.
    4. This prevents those changesets from appearing in merge lists.
    5. No changeset deletion is possible, discard is the standard cleanup method.
     
    This approach effectively removes unwanted changesets from merge consideration.
     
    Thanks
    Nimsara

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Subra Profile Picture

Subra 120

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 92 Super User 2026 Season 1

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 83 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans