When using a DEV and MAIN branch for source code, care must be taken when deleting and recreating files with identical names. For example:
- Developer establishes a branch relationship between source and target (tf branch source target)
- Normal development continues to happen and files get added and merged between these two trees
- Developer deletes a file in source (a.txt)
- Developer adds a file in source with that same name (a.txt) at a later time
- Developer merges these files using the UI (you can also use the command line- tf merge source target /recursive)
- Merge computes and for the file that was deleted and re-added a merge, branch is generated (this is expected)
- Developer goes and checks in
- Developer gets a conflict
There are a number of “proper” ways to sort this out, but these involve an indepth knowledge of TFS and the command line interface.
An alternative is to do the following in the UI (NOTE: you will lose historic data for the deleted file):
- Rename the conflicting file (from a.txt to a.txt.new)
- Delete the original file from source control (a.txt)
- Check-in changes.
- Rename the conflicting file (from a.txt.new to a.txt)
- Check-in changes.
Leave a Reply