Sunday, November 18, 2007

2007-11-18

Just a quick post on how I use Git for my experiments.

I don't know if the way I use it is proper. The plan, at the end of the day, is to be able to merge optimized branches back to master, but without the code added in the profiling branch...

Get the latest sources via svn
mboman@mblxtv01:~/dev/gnome-main-menu> svn checkout svn://svn.gnome.org/svn/gnome-main-menu/branches/openSUSE-10.3/ branch-10.3

Create GIT repo
mboman@mblxtv01:~/dev/gnome-main-menu> cd branch-10.3
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git init
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git add .

Create a new branch
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git branch profiling master

Switch to profiling branch
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git checkout profiling

Add debug code, then commit
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git commit -a -m "Added/Modified Debug Code"


To actually test the debug code, I created a new clone;

mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> cd ..
mboman@mblxtv01:~/dev/gnome-main-menu> git clone branch-10.3 test
mboman@mblxtv01:~/dev/gnome-main-menu> cd test
mboman@mblxtv01:~/dev/gnome-main-menu/test> ./autogen.sh --libexecdir=/usr/lib/gnome-main-menu
mboman@mblxtv01:~/dev/gnome-main-menu/test> make
mboman@mblxtv01:~/dev/gnome-main-menu/test> sudo make install

After each time I did something in the profile branch and commited it;
mboman@mblxtv01:~/dev/gnome-main-menu/test> git pull
mboman@mblxtv01:~/dev/gnome-main-menu/test> make; sudo make install


Once the debug code is added and works as expected, create a new branch to try to optimize something specific.

Create a new branch for optimization test 1 (only create context menu when user right clicks on an application)
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git branch opt-context-menu profiling
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git checkout opt-context-menu

Tip: To see which branch you are actually working on;
mboman@mblxtv01:~/dev/gnome-main-menu/branch-10.3> git branch
master
* opt-context-menu
profiling

No comments: