2

I am new to XCode. Recently started working with a team on an iPhone project. We're using GitHub for our source control, and pulling/comitting/pushing straight from XCode (5.1).

We're all working on master at the moment.

I have noticed that our commit log has a ton of the following statements:

Merge remote-tracking branch 'origin/master'

These seem pretty superfluous. These items are almost always identical to a previous commit from another user.

Example Scenario:

  1. User A and user B do a PULL to start working on code.
  2. User A edits SomeViewController.m and does s COMMIT and a PUSH.
  3. User B edits AnotherViewController.m and does a COMMIT and a PUSH.
  4. User B is greeted with an error [from XCode] that he must PULL before he can COMMIT.
  5. User B does a PULL, then a COMMIT.

Now there are 3 items in the commit log:

  1. The change from User A
  2. The change from User B
  3. Merge remote-tracking branch 'origin/master'

But #1 and #3 are identical! What are we doing wrong? Or is this just a neccessary evil of using Git and XCode together?

Bart
  • 6,694
  • 6
  • 43
  • 53

1 Answers1

1

One solution is to use the rebase command instead of a classic pull (fetch + merge).
You can check the option when doing a pull in XCode.

That would replay your local commits on top of the (fetched and updated) remote tracking branch.

In comamnd line, a nice option is:

  • fetch
  • try a merge
  • if not, try a rebase

See ""Merge remote-tracking branch..." What is this? I don't even. " and
"Why am I merging “remote-tracking branch 'origin/develop' into develop”?"

# download the latest commits
git remote update -p

# update the local branch
git merge --ff-only @{u}

# if the above fails with a complaint that the 
# local branch has diverged:
git rebase -p @{u}
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250