I am fairly new to SourceTree, so apologies if this question appears stupid... I have much more experience from using SVN and earlier CVS, but I think SourceTree works in a different way. I use SourceTree 22.214.171.124 under Windows 10. The central repository is at bitbucket.org .
I have a failed merge, showing in SourceTree as being based on two "branches", one representing my changes (not many), and another branch representing changes by another developer (not many) who probably edited emailed files and then committed them, before I realised that "commit" on its own does not "do that", so I made a push/merge that now reports conflicts.
How can I simply get rid of the merged version and back down to the changed files commtted by the other developer? Double-clicking the desired version advises me that I would get a "detached branch", and I am cautious about using branches for exactly the reason that it might create merge headaches like the current one. "Reset current branch to this commit" worked, but how can I now commit this version to be the current version in the central repository, instead of the version reported to have merge conflicts? I saw another question about "force push", but I do not find the mentioned "Allow force push" checkbox in preferences.
Can someone kindly advise me how to proceed with getting the central repository in a sane state again?
Welcome to Git! I also came from a SVN/CVS background, and found the Git Book (online + free) very helpful in wrapping my head around the subtle but significant differences.
To get rid of your bad merge, there are three possibilities here, in order of simplicity:
Thanks for your reply!
I reverted to the desired version and then made a force-push of it, this solved it. I had to update to the latest SourceTree version to get the preference checkbox where I could enable force-push.
Some other day I will figure out how to install git for use from Cygwin - I assume this is what you mean by "the command line".
I wish SourceTree had warned me about the merge-conflict when I made the earlier push (maybe it did, but it was not obvious enough).
Cygwin is not needed. SourceTree has installed Git in a MinGW environment already. Just hit the Terminal button in the upper right to launch it.
In regards to the conflict warning, your merge dialog looks like this when there are conflicts:
A successful merge will disappear automatically, unless you are showing the full output, which looks like this:
Also also, cygwin in general is no longer necessary for Windows 10. The anniversary edition includes a ubuntu-based bash shell (off by default): http://www.howtogeek.com/265900/everything-you-can-do-with-windows-10s-new-bash-shell/
apt-get install git
Thank you very much for helpful replies!
I don't think I got a warning about the merge conflicts until they were already there, and then I was already a bit stuck.
I tried installing BASH for Windows - what a usability hell! The colours used are terrible, and adjusting them is not easy at all. VI is pretty much unusable since the colours used have lousy contrast. I gave up, will instead use the Terminal window of Github and Cygwin. I might try BASH for Windows again later, once they reach usability that is better than what was available in the mid 1980ies on monochrome screens...
That's fine, use whatever terminal you want. In the past, I've frequently had significant problems getting cygwin functional, but if you had no problems getting it going, that's great.
I've never had SourceTree generate merge conflicts without warning me. Chances are the error dialog came up, and you closed it thinking the merge had failed, but then saw an uncommitted merge commit and figured the solution was obvious. Once the dialog is closed, conflicted files are marked with an exclamation icon in the file change list, but if you have you filter set to something besides "pending", they won't be shown, and SourceTree does NOT warn you about committing conflicts.
I just wanted to "check-in" my changes, so just did a "commit" - yeah, my previous experience from using CVS makes me a little confused about the separate merge/commit/push steps of GIT. It is conceivable that Windows 10 made an automatic reboot (yes a strong reason to avoid it), so I did not even see the merge/commit/push feedback.
I now select the option "Push to default/origin remote when comitting" and hope that this will make things work the way I expect it.
Thanks for your help!
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs