I am working on an MVC5 application where the Entity Framework data access layer is generated with Entity Developer.
We keep source in Git (Git flow) and I have merge conflict issues every time the model changes in a feature when I try rebasing with our main branch.
For example, I am working on a feature which is many commits ahead of develop - when I try rebasing the first issue looks like this:
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: App.Models/App.Base.view
both modified: App.Models/App.PregeneratedViews.cs
both modified: App.Models/App.edml
both modified: App.Models/App.ssdl
Can anyone offer a strategy or advice of how to deal with merge conflict issues arising from using model-first generated code as above?
How can I work with a Git flow process and model-first generated code?
How do others deal with these types of problems?
Should I push for us to ditch model-first and go code-first? (This is the only solution I can see at the moment)
(I realise this might be opinion-based but I believe others will have the same types of problems making the question relevant?)
Well, the solution is simple. Never ever ever ever add generated code to a VCS. Generated code is a build artifact and build artifact have nothing to do in a VCS. They just duplicate the information that is already present in the generation source and thus should not be versioned. This way you will also not have merge conflicts in them, you simply generate the new versions as part of your build.
Related
i am creating a private swift package for myself that I use in a different project.
For the package I have a develop, acceptance and master branch.
When I make a change in the project like a rename or a deletion of a file I merge this to the develop branch.
However when I later merge the develop branch to the acceptance branch or the acceptance branch to master branch I do not see this changes.
Instead the deleted files are back and the file I renamed also get back with the original file name.
I expect merge conflicts but those are not shown.
I checked the .gitignore to see if what gets ignored but I do not see anything that has to do with this.
I am not sure what I am doing wrong here or if it's simply not common for packages to work like this. Anyone got the same problem or tips on how to make it work better?
We have 2 projects, one in rails 2.3.14 and one in rails 3.2.9, we moved the files and changed the structure a bit manually when creating the 3.2.9 repository and now, a few weeks later i want to add all the original repo missing commits to the new repo.
Tried using git format-patch to do it, but since we changed the structure a bit in the new project none of the patches actually applies and returns an error.
Is there a way to do it rather than manually?
try to apply it in the new repo at a revision BEFORE you changed the structure. then merge the new branch into master
Eventually we came to the inevitable conclusion that we have no other option but to merge those changes manually - we exported a patch list from the commits diff and merged the manually one by one, applying the changes in the right places.
Tip for the rest of you: merge frequently if you ever do something like this. applying 533 patches is not a fun thing to do.
I can't figure out the best way to do this and it has happened a few times where I mess myself up that it'd be nice to know a possible good way for this. On master, I have our main project. We finally got approved to use ARC in iOS and I created a new branch for that to not mess with the main working master branch. I also took the time to delete some unneeded files in my ARCBranch. What I want to do is use this branch for development for the next release. I'd like to pull in the changes from master to the ARCBranch. So I switched to ARCBranch, and did
git pull origin master
I got conflicts, some which were straightforward because I could see the code, others being changes in the pbxproj file where I cannot tell what's what. I did see
<<< HEAD ==== >>>. I can't tell what I need to do here. I can't open it in Xcode, only a text editor. I tried just deleting those <<< === >>> characters since I saw one person on SO say that you typically want both changes and that you could always do that. This didn't work for me. I was wondering if there is a better way to do this change. Maybe somewhere where I can see each change by change happen? Thanks.
Instead, you could try
git rebase master
This would apply the changes commit by commit. If there are conflicts, it would stop there, so that you can resolve them and do
git rebase --continue
to finish applying all the patches.
It failed to auto merge so it marks the conflicting blocks of code and leaves them both so you can decide and remove one yourself.
I am working with my co-worker on some files, that are in TFS repository. We have to share these files frequently, however, in the process of our development they are neither compilable, nor working properly. We don't want to put them in the repository, because the rest of the crew shall have problems with compiling the solution. However, the manual sharing would be rather painful. Is there a way to put files on TFS, but not inside repository? (mark as temporary, not finished or something like that).
You can use a shelveset - if you shelve your set of changes then your colleague can pick them up and the other members of the team will never see them. It is a bit of a PITA as you need to have 2 shelvesets (1 each as you can only update your own). The only other way is to branch and then merge when you have compilable code.
Another option is to branch the code into a new branch that the two of you use. When you are done working on the file, and it will no longer break the main build, you can then merge that file back down to the development branch.
When I merge files from one branch to another and then go to check in files into the target branch, there are MANY files checked out, just the ones that changed. For example, Main and Critical branches were the same and we made changes to only 2 or 3 files on the Critical Fix branch. I then merged Critical ==> Main, and when I went to check in changes to the Main branch I noticed that there were numerous files checked out, not just the 2 or 3 that were actually changed in the Critical Fix branch. Moreover, when I compare a file from the Main branch to one on the server, I am told that the files are identical. If the files are identical, why are they checked out? Any help would be appreciated, or even a link that explains how TFS 2010 does merges.
The default Source Control Merging tools in Visual Source Safe and then TFS have always been rather poor - they are often confused by the simplest changes, often detect identical files as being "changed", and the auto-merge facility frequenty fails (includes the wrong changes). I quickly learned distrust for these merge tools (in about 1995) and have not seen any evidence in any of the new releases since then that the core merge algorithms have been improved at all.
The good news is that you can replace the client-side merging tools with third party ones (I use one that works so well that I actually trust its auto-merge option. I once spent 2 days trying (and failing) to do a complex merge with the TFS tools and in the end bought this 3rd party tool and re-did the entire merge successfully in 15 minutes!)
The bad news is that the first step of branch merging just uses the TFS merge code, and so it gets confused a lot, resulting in the symptoms you've described. This is frustrating in such a key feature of such an expensive application as it wastes a lot of programmer time on every merge to fix imaginary "conflicts" - on the plus side, with the help of 3rd party tools it is usually very easy to reliably resolve these merge issues.
I have had the same problem. I created a branch of our DEV branch and made changes to a few files. I checked in my changes and merged the latest changes to DEV into my branch. After the merge all 30,000+ files in my branch were marked as changed. Just like cju, I found that a comparison of most of the files showed that no changes had been made.
I decided to undo all changes and try again. When I right-clicked on the solution and selected Undo, I got a message that one file had changes, was I sure I wanted to undo that file? I clicked "No to All" and when the undo operation was complete, only the files that had been changed during my merge from DEV were still checked out. This was exactly what I wanted so I checked those changes into my branch and continued working.
I hope others can correct their situation as easily as I was able to.
One thing I noticed is that when one file is changed in different branches resulting in exactly the same content, then merging marks it as a conflict since the file is changed in both places. Of course a difference view of the file notices that there are no changes and therefore an auto merge solves this automatically for you.