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
Comments
Post new comment