important : Git branch switch

Edward Hervey bilboed at gmail.com
Mon Mar 26 08:47:44 PDT 2012


Just an example of what happens before/after switching, by using
gst-plugins-good as an example:

 gst-plugins-good $ git branch -v
 * master          a199ad9 speexdec: use base class tag handling helper

Now let's fetch the remote commits:

 gst-plugins-good $ git remote update -p
 Fetching origin
 remote: Counting objects: 1328, done.
 remote: Compressing objects: 100% (562/562), done.
 remote: Total 810 (delta 705), reused 275 (delta 248)
 Receiving objects: 100% (810/810), 149.95 KiB | 254 KiB/s, done.
 Resolving deltas: 100% (705/705), completed with 301 local objects.
 From ssh://git.freedesktop.org/git/gstreamer/gst-plugins-good
  + cdabb85...e780771 0.10       -> origin/0.10  (forced update)
    cb0d04a..02114c1  0.11       -> origin/0.11
    a199ad9..01838ff  master     -> origin/master
 From ssh://git.freedesktop.org/git/gstreamer/gst-plugins-good
  * [new tag]         RELEASE-0.11.2 -> RELEASE-0.11.2

Checking again our local status tells us we're waaay behind:

 gst-plugins-good $ git branch -v
 * master          a199ad9 [behind 798] speexdec: use base class ...

Let's switch master to track origin/0.10:
 gst-plugins-good $ git branch master --set-upstream origin/0.10 
 Branch master set up to track remote branch 0.10 from origin.

And check it's fixed:

gst-plugins-good $ git branch -v
* master          a199ad9 [behind 20] speexdec: use base class tag ...

 \o/ Yay it's only 20 behind (which is normal since some commits
happened in 0.10 since I last fetched updates).

I can now fast forward to the current upstream state as usual.

  Hope this helps,

    Edward




More information about the gstreamer-devel mailing list