Skip to main content
Topic: Git help (Read 6287 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Git help

Hi there, need some help with git. What I want to do is the following:
add Spuds & emanuele's repos to my local elkarte repo in order to test their branches (likes, menition etc)..
I did that with Norv's repo but don't remember how :P

Can someone guide me please? Is this correct for Spuds likes branch?
Code: [Select]
git remote add spuds_elk https://github.com/Spuds/elkarte.git
git branch spuds_likes spuds_elk/likes
git checkout spuds_likes
git fetch spuds_elk
git merge spuds_elk/likes


Thorsten "TE" Eurich
------------------------

Re: Git help

Reply #1

Code: [Select]
git remote add spuds_elk https://github.com/Spuds/elkarte.git
git fetch spuds_elk
git checkout spuds_elk/likes
git checkout -b spuds_likes
May be the last two steps may be merged...dunno.
Then you can either merge or rebase (Norv usually prefers rebases :P):
Code: [Select]
git rebase master
Code: [Select]
git merge master
Bugs creator.
Features destroyer.
Template killer.

Re: Git help

Reply #2

Thank you :)
Thorsten "TE" Eurich
------------------------

Re: Git help

Reply #3

Oudated topic, bit I need help again and don't want to start a new topic:
My branches were totally outdated, I believe I've fixed the master with:
Code: [Select]
git fetch upstream (upssream is the elkarte/elkarte account)
git checkout master
git reset --hard upstream/master
git push --force origin master (origin my forked ElkArte repo on github)
master seems to be synced with the elkarte repo :)

Just wanted to do the same with the developement branch, but can't checkout to that branch.. constantly getting : The following untracked file would be overwritten by checkout:
sources/controllers/XMLPreview.controller.php

Any ideas how to fix that?

and by the way, which branch is the right one for working on 1.1 or working on 2.0?
master 1.1 and developement for 2.0?

Sorry, haven't worked with git for over a year, just feel like a beginner now :P
Thorsten "TE" Eurich
------------------------

Re: Git help

Reply #4

Quote from: TE – Oudated topic, bit I need help again and don't want to start a new topic:
My branches were totally outdated, I believe I've fixed the master with:
Code: [Select]
git fetch upstream (upssream is the elkarte/elkarte account)
git checkout master
git reset --hard upstream/master
git push --force origin master (origin my forked ElkArte repo on github)
master seems to be synced with the elkarte repo :)

Just wanted to do the same with the developement branch, but can't checkout to that branch.. constantly getting : The following untracked file would be overwritten by checkout:
sources/controllers/XMLPreview.controller.php

Any ideas how to fix that?
It just means you have a file (sources/controllers/XMLPreview.controller.php) that is present in the directory, but not tracked (or more likely there are edits not committed, maybe you changed something and did not commit it).
Delete it and you will be able to checkout.

What I usually do in such cases (of badly outdated/potentially broken branches) is to:
Code: [Select]
git checkout -b master_broken
git checkout master
git reset --hard HEAD~100
git pull elkarte master
git push elkarte master

Quote from: TE – and by the way, which branch is the right one for working on 1.1 or working on 2.0?
master 1.1 and developement for 2.0?
Reference: http://nvie.com/posts/a-successful-git-branching-model/
master is only for the latest release.
Currently the work towards 1.1.1 is done in patch_1-1-1.
development is for 2.0.
:D
Bugs creator.
Features destroyer.
Template killer.

Re: Git help

Reply #5

Btw, it may not work out with a "totally outdated" branch but my preferred method to pull upstream is git pull -r upstream master. That way you rebase your local commits on top of upstream. Of course you might have to do conflict resolution, but you'll have to do that anyway.

Quotesources/controllers/XMLPreview.controller.php

Any ideas how to fix that?
Unless you want to keep it, just delete it.