[Ovirt-devel] new git branch: "next"

Jim Meyering meyering at redhat.com
Fri Jun 20 08:54:23 UTC 2008


Jim Meyering <jim at meyering.net> wrote:
> I've just pushed the following to the new, "next" branch:
>
>   http://git.et.redhat.com/?p=ovirt.git;a=shortlog;h=next

[Policy, like "what's this branch for" will come next week, but for
 now, we're expecting at least some new development to happen on "next".
 Then, once stabilized, pieces will migrate onto "master". ]

Since I've pushed the first changes to this new "next" branch,
I figure I should describe how to use that branch.
(I use git a lot, but am no guru, so if you know of a better
way to do any of this, please tell us):

First of all, running "git branch", doesn't even show the
new branch, but "git branch -a" does show "origin/next".

Run this to tell git you want to fetch from "next",
much like you fetch from "master":

    git config remote.origin.fetch +next:next

[notice that that adds lines to .git/config]
Then, after a subsequent "fetch" or "pull" command, git branch
will list the new branch name:

    $ git branch
    * master
      next

In general, when there is nontrivial branching, running "gitk --all"
(to display "all" branches rather than just the current one)
gives a good graphical diagram of how the branches interconnect.

If you want to move a change from elsewhere (say relative to master) onto
next, first prepare it as usual with "git format-patch ...", and then
do this to start a topic branch named T that forks off of "next":[1]

    g co next
    g co -b T
    g am PATCH_FILE

where PATCH_FILE might be 0001-... or whatever you called
the output of your git format-patch command.

Then you want to push your change, but
notice that someone has committed a change
to "next" in the mean time.  Since you've committed
nothing on "next", you can simply pull in the latest
with no risk of conflict:

    g co next
    g pull

Then you get on your topic branch and rebase it relative to "next":

    g co T
    g rebase next

[it's at this stage, the "rebase" that you may have to resolve conflicts
 and hence "g add file-with-conflict", then "g rebase --continue"]
And finally, get on "next" again and pull all changes from T onto your
local "next" branch, and push your work to the public "next" branch:

    g co next
    g pull . T
    g push

Jim
-----------
[1] now using the shell alias g=git
and abbreviations like "co" for "checkout".  Put the following in ~/.gitconfig:
[alias]
        st = status
        co = checkout
        ci = commit
        br = branch




More information about the ovirt-devel mailing list