[jitsi-dev] Git merge


#1

Hey Boris, all devs

I'm a bit confused (and worried) about the "Merge branch 'master' of
github.com:jitsi/jitsi" commits repeatedly appearing in the master branch.

I don't know git to well either, but my guess is that some of you are
committing locally to the master branch, then pulling which causes a merge.
AFAIK good practice would be:
- always work and commit on a topic branch (these should all be small
commits instead of one big change all)
- if ready to publish, switch to master
- pull from github
- merge the topic-branch
  - no conflicts: good, push
  - conflicts:
    - if the topic branch was never shared with anybody
      - undo the merge
      - switch back to topic branch
      - rebase it onto master
      - repeat from start
    - resolve the conflicts and push

I also see that a Pootle was involved in the last message, so this probably
also contributes to the confusion. But I don't get why Boris should have
committed a Pootle-change from Emil?

So in order to avoid that strange stuff, could please all of you pay
attention what you were doing before pushing and post the results here when
it happens again?

And if anyone with more git-experience than us follows the list, any
explanation and tips would be welcome.

Regards,
Ingo


#2

Х

Hey Boris, all devs

I'm a bit confused (and worried) about the "Merge branch 'master' of
github.com:jitsi/jitsi" commits repeatedly appearing in the master branch.

I don't know git to well either, but my guess is that some of you are
committing locally to the master branch, then pulling which causes a merge.

I'm confused as well. I assumed pulling was a safe thing to do...

AFAIK good practice would be:
- always work and commit on a topic branch (these should all be small
commits instead of one big change all)
- if ready to publish, switch to master
- pull from github
- merge the topic-branch
  - no conflicts: good, push
  - conflicts:
    - if the topic branch was never shared with anybody
      - undo the merge
      - switch back to topic branch
      - rebase it onto master
      - repeat from start
    - resolve the conflicts and push

Thanks! I'll follow that in future.

I also see that a Pootle was involved in the last message, so this probably
also contributes to the confusion. But I don't get why Boris should have
committed a Pootle-change from Emil?

So in order to avoid that strange stuff, could please all of you pay
attention what you were doing before pushing and post the results here when
it happens again?

I have no idea what caused the pootle commit.

I *think* what I did today was this: tried to pull from github into my
'jingle' branch, which didn't work. Pulled into local master (which
wasn't clean and maybe caused a merge). Cleaned local master. Rebased
'jingle'. Merged 'jingle' into local master. Pulled again, because
you'd made a commit. Pushed.

I could remember incorrectly, though.

Regards,
Boris

···

On Sat, May 4, 2013 at 8:00 PM, Ingo Bauersachs <ingo@jitsi.org> wrote:


#3

All devs, Emil,

I'm not sure if we can apply the "gitflow" model to Jitsi because of its SVN
history. Nevertheless the "gitflow" description at

  http://nvie.com/posts/a-successful-git-branching-model/

also gives a good description how to use feature branches that Ingo mentions
below. The description shows the git commands to use and the reasons behind.
Small deviation from the flow are of course possible and in many cases. However,
how to solve conflicts is not part of the description because you can do it
in several ways.

Werner

···

Am 04.05.2013 19:00, schrieb Ingo Bauersachs:

Hey Boris, all devs

I'm a bit confused (and worried) about the "Merge branch 'master' of
github.com:jitsi/jitsi" commits repeatedly appearing in the master branch.

I don't know git to well either, but my guess is that some of you are
committing locally to the master branch, then pulling which causes a merge.
AFAIK good practice would be:
- always work and commit on a topic branch (these should all be small
commits instead of one big change all)
- if ready to publish, switch to master
- pull from github
- merge the topic-branch
  - no conflicts: good, push
  - conflicts:
    - if the topic branch was never shared with anybody
      - undo the merge
      - switch back to topic branch
      - rebase it onto master
      - repeat from start
    - resolve the conflicts and push

I also see that a Pootle was involved in the last message, so this probably
also contributes to the confusion. But I don't get why Boris should have
committed a Pootle-change from Emil?

So in order to avoid that strange stuff, could please all of you pay
attention what you were doing before pushing and post the results here when
it happens again?

And if anyone with more git-experience than us follows the list, any
explanation and tips would be welcome.

Regards,
Ingo

--
----------------------------------------------
Werner Dittmann Werner.Dittmann@t-online.de
Tel +49 173 44 37 659
PGP key: 82EF5E8B


#4

From: Boris Grozev [mailto:boris@jitsi.org]

Hey Boris, all devs

I'm a bit confused (and worried) about the "Merge branch 'master' of
github.com:jitsi/jitsi" commits repeatedly appearing in the master

branch.

I don't know git to well either, but my guess is that some of you are
committing locally to the master branch, then pulling which causes a

merge.

I'm confused as well. I assumed pulling was a safe thing to do...

git pull is actually two actions: 'git fetch' followed by 'git merge'. While
fetch is always safe to do, merge obviously isn't.

Never tried this, but I _think_ you could still commit on master (avoiding
topic branches for small stuff) by doing:
- commit on master
- git fetch
- git rebase FETCH_HEAD

[...]

I also see that a Pootle was involved in the last message, so this

probably

also contributes to the confusion. But I don't get why Boris should have
committed a Pootle-change from Emil?

So in order to avoid that strange stuff, could please all of you pay
attention what you were doing before pushing and post the results here

when

it happens again?

I have no idea what caused the pootle commit.

I *think* what I did today was this: tried to pull from github into my
'jingle' branch, which didn't work.

This can't work because a local branch is mapped to master, it has no origin
to pull from. It shouldn't cause any harm though.

Pulled into local master (which wasn't clean and maybe caused a merge).

I guess you were on 377fa5cfa3, pulled, which somehow created the weird
d661093fff (Pootle authored by Emil), followed by 0624917501 (the first
merge).

Cleaned local master.

Whatever that was is either the merge 0624917501 or not visible in public.

Rebased 'jingle'.
Merged 'jingle' into local master.

Went clean I guess, probably a fast-forward and the 3 newest commits at the
time of writing.

Pulled again, because you'd made a commit.

Sorry :slight_smile:
This created 935e272fdf. It seems we'd need to create a policy how to handle
merges on the master-branch as situations like this are unavoidable.
- Allow them: not nice for the history (but shouldn't cause harm)
- Forbid them: don't push and resolve again (undo the merge of the pull and
the topic branch, pull (should then be a fast-forward), merge topic again,
push)

Pushed.

I could remember incorrectly, though.

Apart from the strange pootle commit, this all makes sense.

Regards,
Boris

Ingo

···

On Sat, May 4, 2013 at 8:00 PM, Ingo Bauersachs <ingo@jitsi.org> wrote:


#5

Just to mention a shorter version of the rebase part:
- commit on master
- git pull --rebase

I'm personally a fan of rebasing since it maintains linear history, but it has some cons - e.g. if you've already made a branch public, and probably others I'm unaware of.

Cheers,
Ivan

···

Sent from my iPhone

On May 4, 2013, at 10:33 PM, "Ingo Bauersachs" <ingo@jitsi.org> wrote:

From: Boris Grozev [mailto:boris@jitsi.org]

On Sat, May 4, 2013 at 8:00 PM, Ingo Bauersachs <ingo@jitsi.org> wrote:

Hey Boris, all devs

I'm a bit confused (and worried) about the "Merge branch 'master' of
github.com:jitsi/jitsi" commits repeatedly appearing in the master

branch.

I don't know git to well either, but my guess is that some of you are
committing locally to the master branch, then pulling which causes a

merge.

I'm confused as well. I assumed pulling was a safe thing to do...

git pull is actually two actions: 'git fetch' followed by 'git merge'. While
fetch is always safe to do, merge obviously isn't.

Never tried this, but I _think_ you could still commit on master (avoiding
topic branches for small stuff) by doing:
- commit on master
- git fetch
- git rebase FETCH_HEAD

[...]

I also see that a Pootle was involved in the last message, so this

probably

also contributes to the confusion. But I don't get why Boris should have
committed a Pootle-change from Emil?

So in order to avoid that strange stuff, could please all of you pay
attention what you were doing before pushing and post the results here

when

it happens again?

I have no idea what caused the pootle commit.

I *think* what I did today was this: tried to pull from github into my
'jingle' branch, which didn't work.

This can't work because a local branch is mapped to master, it has no origin
to pull from. It shouldn't cause any harm though.

Pulled into local master (which wasn't clean and maybe caused a merge).

I guess you were on 377fa5cfa3, pulled, which somehow created the weird
d661093fff (Pootle authored by Emil), followed by 0624917501 (the first
merge).

Cleaned local master.

Whatever that was is either the merge 0624917501 or not visible in public.

Rebased 'jingle'.
Merged 'jingle' into local master.

Went clean I guess, probably a fast-forward and the 3 newest commits at the
time of writing.

Pulled again, because you'd made a commit.

Sorry :slight_smile:
This created 935e272fdf. It seems we'd need to create a policy how to handle
merges on the master-branch as situations like this are unavoidable.
- Allow them: not nice for the history (but shouldn't cause harm)
- Forbid them: don't push and resolve again (undo the merge of the pull and
the topic branch, pull (should then be a fast-forward), merge topic again,
push)

Pushed.

I could remember incorrectly, though.

Apart from the strange pootle commit, this all makes sense.

Regards,
Boris

Ingo


#6

Hey

From: Boris Grozev [mailto:boris@jitsi.org]

[...]

I *think* what I did today was this: tried to pull from github into my
'jingle' branch, which didn't work.

This can't work because a local branch is mapped to master, it has no origin
to pull from. It shouldn't cause any harm though.

Pulled into local master (which wasn't clean and maybe caused a merge).

I guess you were on 377fa5cfa3, pulled, which somehow created the weird
d661093fff (Pootle authored by Emil), followed by 0624917501 (the first
merge).

Yep, that makes sense, I don't think I've done anything since I did a
clone a few days ago (around the time 377fa5cfa3 was committed).

Oh, I remember. The pull failed, because I had changes to .gitignore.
This must have happened on ce3dad1cf9, so Emil's pootle commit
(733053f607) would have been the only one merged at this point. Maybe
single-commit merges show this way? I then reverted all my
modifications and pulled again.

Cleaned local master.

Whatever that was is either the merge 0624917501 or not visible in public.

What I meant was that I had non-committed modifications on master and
reverted/put them in .git/info/exclude.

Anyway, sorry for polluting the history and thanks for helping figure
out what happened.

Regards,
Boris

···

On Sat, May 4, 2013 at 10:33 PM, Ingo Bauersachs <ingo@jitsi.org> wrote: