Archive

Archive for September, 2011

Merging a parent dev branch with your dev branch on gitHub.

September 3rd, 2011 No comments

Git can be complicated for beginners, and I found myself trashing my branch a few times in order to merge. So these are my notes for future reference and put here to help you if necessary,

The dev branch I am working with is remove_smarty. To clone my own I issue the command

git clone --branch remove_smarty https://jamesarbrown@github.com/jamesarbrown/poMMo.git remove_smarty
git clone –branch <branch name> <git hub url> <folder I want to call it>

Now cd into the directory.

So if we look at the branches we get

git branch -r
origin/HEAD -> origin/master
origin/master
origin/remove_smarty 

So now I want to add the branch I originally forked from.

git remote add -t remove_smarty soonick https://github.com/soonick/poMMo.git
git remote add -t <branch name> <what I want to call it> <github URL>

Now we can fetch that branch

git fetch soonick
git fetch <what I called it>

and this can be confirmed by

git branch -r
origin/HEAD -> origin/master
origin/master
origin/remove_smarty
soonick/remove_smarty 

And now to merge that in

 git merge soonick/remove_smarty 

Which resulted in some conflicts

Auto-merging themes/default/inc/admin.footer.php
CONFLICT (content): Merge conflict in themes/default/inc/admin.footer.php
Automatic merge failed; fix conflicts and then commit the result. 

If you open a file with conflicts you will see something like this

<<<<<<< HEAD 
This is code in my head
=======
This is code commited by soonic
>>>>>>> soonick/remove_smarty

Regard the ======= as OR

 

Delete above or below as applicable, mix, what ever you want and once done you can commit. (for which I use git-gui)

 

 

 

 

Categories: Fedora Linux Tags: