Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] wiki page for merge conflicts resolution FAQ #102

Open
maximveksler opened this issue Aug 30, 2015 · 0 comments
Open

[Enhancement] wiki page for merge conflicts resolution FAQ #102

maximveksler opened this issue Aug 30, 2015 · 0 comments

Comments

@maximveksler
Copy link

When you get a conflict as such:

Maxims-MacBook-Pro:zone-ios maximveksler$ git up
Fetching origin
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 9 (delta 4), reused 8 (delta 3), pack-reused 0
Unpacking objects: 100% (9/9), done.
From github.com:reffael/zone-ios
   2d7cb21..b8b5274  master     -> origin/master
Nava_UI_Branch up to date
master         rebasing...
Failed to rebase master onto origin/master
Here's what Git said:
First, rewinding head to replay your work on top of it...
Applying: Adding radar view and profile fixes.
Using index info to reconstruct a base tree...
M   ParseStarterProject/Base.lproj/Main.storyboard
M   Zone.xcodeproj/project.pbxproj
Falling back to patching base and 3-way merge...
Auto-merging Zone.xcodeproj/project.pbxproj
Auto-merging ParseStarterProject/Base.lproj/Main.storyboard
CONFLICT (content): Merge conflict in ParseStarterProject/Base.lproj/Main.storyboard
Patch failed at 0001 Adding radar view and profile fixes.
The copy of the patch that failed is found in:
   /Users/maximveksler/Developer/zone-ios/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

<stdin>:85: trailing whitespace.

<stdin>:87: trailing whitespace.

<stdin>:90: trailing whitespace.

<stdin>:94: trailing whitespace.

<stdin>:96: trailing whitespace.

warning: squelched 53 whitespace errors
warning: 58 lines add whitespace errors.
Failed to merge in the changes.

What do you do?

If you try the recommended git rebase --continue you get the following.

Maxims-MacBook-Pro:zone-ios maximveksler$ git rebase --continue
ParseStarterProject/Base.lproj/Main.storyboard: needs merge
You must edit all merge conflicts and then
mark them as resolved using git add
Maxims-MacBook-Pro:zone-ios maximveksler$ git status
rebase in progress; onto b8b5274
You are currently rebasing branch 'master' on 'b8b5274'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   ParseStarterProject/CTMemCache.swift
    modified:   ParseStarterProject/MyZoneRadarViewController.swift
    modified:   ParseStarterProject/UserProfileViewController.swift
    modified:   Zone.xcodeproj/project.pbxproj

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

    both modified:   ParseStarterProject/Base.lproj/Main.storyboard

so now one would go and attempt to fix the conflicts:

Maxims-MacBook-Pro:zone-ios maximveksler$ mate ParseStarterProject/Base.lproj/Main.storyboard

check the status

Maxims-MacBook-Pro:zone-ios maximveksler$ git status
rebase in progress; onto b8b5274
You are currently rebasing branch 'master' on 'b8b5274'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   ParseStarterProject/CTMemCache.swift
    modified:   ParseStarterProject/MyZoneRadarViewController.swift
    modified:   ParseStarterProject/UserProfileViewController.swift
    modified:   Zone.xcodeproj/project.pbxproj

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

    both modified:   ParseStarterProject/Base.lproj/Main.storyboard

Commit your fixes

Maxims-MacBook-Pro:zone-ios maximveksler$ git add ParseStarterProject/Base.lproj/Main.storyboard

check the status:

Maxims-MacBook-Pro:zone-ios maximveksler$ git status
rebase in progress; onto b8b5274
You are currently rebasing branch 'master' on 'b8b5274'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   ParseStarterProject/Base.lproj/Main.storyboard
    new file:   ParseStarterProject/CTMemCache.swift
    modified:   ParseStarterProject/MyZoneRadarViewController.swift
    modified:   ParseStarterProject/UserProfileViewController.swift
    modified:   Zone.xcodeproj/project.pbxproj

and commit:

Maxims-MacBook-Pro:zone-ios maximveksler$ git commit -a -m'Merge Zonned Out'
[detached HEAD 705cf5f] Merge Zonned Out
 5 files changed, 297 insertions(+), 62 deletions(-)
 create mode 100644 ParseStarterProject/CTMemCache.swift

But now if you try to push, you're stuck

Maxims-MacBook-Pro:zone-ios maximveksler$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

    git push origin HEAD:<name-of-remote-branch>

and if you try to rebase again,

Maxims-MacBook-Pro:zone-ios maximveksler$ git rebase --continue
Applying: Adding radar view and profile fixes.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

You're still stuck

Maxims-MacBook-Pro:zone-ios maximveksler$ git status
rebase in progress; onto b8b5274
You are currently rebasing branch 'master' on 'b8b5274'.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working directory clean

So a wiki FAQ would be in order about what should be done at this point.

The solution that worked for me btw is

Maxims-MacBook-Pro:zone-ios maximveksler$ git push origin HEAD:master
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (10/10), 4.41 KiB | 0 bytes/s, done.
Total 10 (delta 5), reused 0 (delta 0)
To [email protected]:reffael/zone-ios.git
   b8b5274..705cf5f  HEAD -> master
Maxims-MacBook-Pro:zone-ios maximveksler$ git up
Fetching origin
You're not currently on a branch. I'm exiting in case you're in the middle of something.
Maxims-MacBook-Pro:zone-ios maximveksler$ git status
rebase in progress; onto b8b5274
You are currently rebasing branch 'master' on 'b8b5274'.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working directory clean
Maxims-MacBook-Pro:zone-ios maximveksler$ git rebase --continue
Applying: Adding radar view and profile fixes.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Maxims-MacBook-Pro:zone-ios maximveksler$ git checkout master
Previous HEAD position was 705cf5f... Merge Zonned Out
Switched to branch 'master'
Your branch and 'origin/master' have diverged,
and have 1 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
Maxims-MacBook-Pro:zone-ios maximveksler$ git up
Fetching origin
Nava_UI_Branch up to date
master         rebasing...
Failed to rebase master onto origin/master
Here's what Git said:

It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
    git rebase (--continue | --abort | --skip)
If that is not the case, please
    rm -fr "/Users/maximveksler/Developer/zone-ios/.git/rebase-apply"
and run me again.  I am stopping in case you still have something
valuable there.
Maxims-MacBook-Pro:zone-ios maximveksler$ rm -fr "/Users/maximveksler/Developer/zone-ios/.git/rebase-apply"
Maxims-MacBook-Pro:zone-ios maximveksler$ git up
Fetching origin
Nava_UI_Branch up to date
master         rebasing...
Failed to rebase master onto origin/master
Here's what Git said:
First, rewinding head to replay your work on top of it...
Applying: Adding radar view and profile fixes.
Using index info to reconstruct a base tree...
M   ParseStarterProject/Base.lproj/Main.storyboard
M   ParseStarterProject/MyZoneRadarViewController.swift
M   ParseStarterProject/UserProfileViewController.swift
M   Zone.xcodeproj/project.pbxproj
Falling back to patching base and 3-way merge...
Auto-merging ParseStarterProject/Base.lproj/Main.storyboard
CONFLICT (content): Merge conflict in ParseStarterProject/Base.lproj/Main.storyboard
Patch failed at 0001 Adding radar view and profile fixes.
The copy of the patch that failed is found in:
   /Users/maximveksler/Developer/zone-ios/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

<stdin>:85: trailing whitespace.

<stdin>:87: trailing whitespace.

<stdin>:90: trailing whitespace.

<stdin>:94: trailing whitespace.

<stdin>:96: trailing whitespace.

warning: squelched 53 whitespace errors
warning: 58 lines add whitespace errors.
Failed to merge in the changes.
Maxims-MacBook-Pro:zone-ios maximveksler$ git status
rebase in progress; onto 705cf5f
You are currently rebasing branch 'master' on '705cf5f'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

    both modified:   ParseStarterProject/Base.lproj/Main.storyboard

no changes added to commit (use "git add" and/or "git commit -a")
Maxims-MacBook-Pro:zone-ios maximveksler$ git rebase --skip
Maxims-MacBook-Pro:zone-ios maximveksler$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

yet sure this is not the smartest way to to do things.

@maximveksler maximveksler changed the title Adding a wiki page about how to resolve conflicts ? [Enhancement] wiki page for merge conflicts resolution FAQ Aug 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant