KJC2009
KJC2009

Reputation: 59

git in Xcode 5 (merge vs push)

I'm learning how to use repositories in Xcode 5.

I'd like to push my changes to a different remote branch. Is there a difference between these two things?

  1. I go to Source Control Menu, then Commit, and then check "Push To Remote" and select the different branch. (So I push my changes in one step.)

  2. I switch to the other branch locally, pull the changes, then merge from my previous branch, then push this branch to the remote.

The obvious difference is that I won't have an updated local copy of the other branch in the first case. My Question: Are they completely the same? Which one is preferred?

So far I've been working alone on the project. I had a master branch and a dev branch. I'm usually working on the dev branch, and when I have a stable version or finished a new feature, I commit it to the master branch. This can be easily done by pushing it to the master branch, without switching to it first.

Upvotes: 0

Views: 230

Answers (2)

Superman2013
Superman2013

Reputation: 41

both merge and pull do seem completely identical to me. Like David said, If you find the origin is ahead of master you need to pull and then possibly resolve merge conflicts. Then you commit the merge. Then you can push.

Upvotes: 0

Jeff
Jeff

Reputation: 513

They do seem completely identical to me. I'm just wondering why you're pushing to a branch other than the one you're editing on. Are you making changes then realizing you didn't want to do that on master?

if you find the origin is ahead of master you need to pull and then possibly resolve merge conflicts. Then you commit the merge. Then you can push. You might find it easier to do with a tool like SourceTree. Best,

Upvotes: 1

Related Questions