User login

Updating a module in Git (the hard way, resolving a conflict)

(Some old notes from Stefan that I had to look up, so putting them online).

yesterday night i learnt some git. now i can tell you the meaning of fast-forward.
when you create a new branch off another one and after some time you want to merge the changes and the other branch hasn't advanced it's a fast forward merge. otherwise a merge commit will be crated.
if you want to merge changes to the original branch you forked off you should firts pull any changes from that one before merging or tou risk losing commits.

Git push failed.

But then the git pull from a repository

git merge resolve

fatal: You are in the middle of a conflicted merge.

git reset --hard HEAD

HEAD is now at bb4d323 Updated to the latest stable Views, 6.x-2.2 (2008-Dec-16

vi .git/config

[remote "origin"]
url = git@github.com:scf/scf.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

I should have been connected to
git@github.com:benjamin-agaric/scf.git

and we did change to that.

And then added github as a remote.

git remote add upstream git://github.com/scf/scf.git

But to actually fix this conflicted merge, which actually came down to just the views module, we got our scf/scf repository locally, deleted views, and git pulled from the updated benjamin-agaric branch:

git clone git@github.com:scf/scf.git /RCS/git/scf-scf
cd /RCS/git/scf-scf/
git rm -r modules/contrib/views
git status
git commit -m "remove old views"
git pull git@github.com:benjamin-agaric/scf.git master
git add modules/contrib/views/
git status
git commit -m "Merged with new files and new VIEWS 2 wohoo"
git push

It still caused a conflict, so the key step is the fourth-to-last one (including the informational git status)-- the git add. This dispatches the conflict, and only works because we deleted it. Pushing then worked!

Reference

http://book.git-scm.com/5_advanced_branching_and_merging.html
http://www.kernel.org/pub/software/scm/git/docs/git-commit.html
http://www.kernel.org/pub/software/scm/git/docs/v1.0.13/git-reset.html

Resolution

Searched words: 
git handling conflicts tell git to choose one branch git resolve merge in favor of local commit surely there's some way to pick one or the other? It's only the views module it's trying to merge, and I know my local commit is the one i want. man

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.