0

We have been using tortoise svn for quite a while and loved it. When we did an update it would automatically merge and if there were conflicts it would produce a conflict file and I could use the merge tool on it.

With tortoisegit, if someone has been in the file it does not even attempt to merge just produces message similar to "Cant". Is this a problem with git or tortoisegit. We used tortoisegit because of how easy tortoise svn was to use and did not get in the way. Whereas with tortoise git we get the "CANT" and many dialogs to click on when we do anything.

How can I merge in tortoisegit if there is a conflict, and is there someway to tell it to produce conflict files.

1 Answer 1

0

I will try to summarize how Git synchronization with remote repository works.

  1. You Commit your changes into a local branch.
  2. You want to Push your changes into remote repository. If Git finds out there are new changes in remote tracking branch, it will not allow the Push and will say "you have to do Pull first". (This is a restriction in the Git itself, not only in TortoiseGit.)
  3. As per instructions you do Pull. New merge commit combining yours and others' changes has to be created. If there is no conflict, merge commit is created automatically. If there is a conflict, TortoiseGit force you to resolve it and Commit changes manually.
  4. Finally, you do Push.

I think the main difference from SVN schema is the creation of merge commit, but I don't see this as a disadvantage at all.

A good way to avoid merge commits is to always do Pull before committing so you commit to the newest version of the branch. However if you have working tree changes in a file which needs to be updated during Pull, Git will say Your local changes to the following files would be overwritten by merge and Please commit your changes or stash them before you merge. In this case you should do Stash changes, repeat Pull and finally do Stash Pop.

You may call all these operations from TortoiseGit context menu or you may try to use Git Sync dialog.

Sign up to request clarification or add additional context in comments.

4 Comments

I do a pull first always, however the pull is failing because at times someone else has worked in the same file. That is when the CANT messages show up. It will not do the pull and try to merge or if that fails product a conflict file where we can see and merge local changes with those in the repo for that file. I never try to commit first, commit would be my second step once my repo is up to date. My question is why doesn't git try to merge or at least produce a conflict. SVN is much better at an update than git.
@dgxhubbard Sorry, I have not considered this situation. Please see my updated answer.
In the question what I am trying to point out is I believe git does not even attempt to merge nor does it produce a conflict file. Producing a conflict file like tortoise svn would be more desirable than putting my changes aside, doing a pull and then doing a merge. The conflict file stream lines the process.
@dgxhubbard It is really worth doing Stash changes before pulling conflicting changes, because this way you back up your working tree changes into the stash. Otherwise pulled changes would get mixed with your working tree changes and you would not be able to recover your working tree state before pull (you would need to recover e. g. in case you are not able to resolve conflict at the moment or you resolve it in a wrong way and need to start again). Moreover, doing stash push/pop is quite an easy operation and in case no conflict arises you don't have to do it at all.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.