Ray Richards
Ray Richards

Reputation: 127

Git merge issue

I am using a local repository (which doesn't work at all like the local repository seemed to work in the Xcode demo I watched on Lynda.com). The only way I can get it to work is to create another copy of my project directory and then point to that as a working directory within Organizer. Ok... that's fine, though it wasn't supposed to work like that according to the demo which I followed step-by-step.

Now my current issue is that when I wanted to check something on my production branch while I was working on another that had some uncommitted changes, I switched branches and it merged all the files!!! Seriously... wtf. So now my production project is completely screwed and it won't let me switch back to the other branch either until I fix the merge conflict.

So my question is: is this regular git behaviour, or is my repository system screwy? If it is indeed regular behaviour, you'd think there'd be at least a warning dialogue telling you that you have uncommitted changes and that it's going to merge your branches.

Upvotes: 1

Views: 579

Answers (2)

tpg2114
tpg2114

Reputation: 15100

Git generally doesn't let you switch branches with uncommited changes. You either have to commit them or stash them before moving branches.

Look up git-stash to see how that works.

I've never used git through Xcode, so I have a feeling it's doing something strange behind the scenes because it is not normal for this to happen. It will complain about a dirty work tree and tell you to stash before switching branches.

Upvotes: 1

James Sumners
James Sumners

Reputation: 14775

I don't know Git that well. I mainly use Mercurial. So I can't give you a better answer than this:

You might want to look at the Pro Git book. Also, familiarize yourself with Git on the command line before you start working with it via Xcode. A solid understanding of the actual Git tools will help you understand the way the IDE interface works.

Upvotes: 1

Related Questions