SGDDevGIT

From Super Grub Disk Wiki
Jump to: navigation, search

This page is a draft and we will be improved.


Contents

Create a blank folder

mkdir git

Get the repository

git clone git://git.berlios.de/supergrub
cd supergrub

Check fetched branches

git branch -a

You should have an output similar to this one:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/baells
  remotes/origin/baellsdeb
  remotes/origin/castillonroy
  remotes/origin/master
  remotes/origin/test

Create local branches associated to remote branches

git checkout -b baells remotes/origin/baells
git checkout -b baellsdeb remotes/origin/baellsdeb
git checkout -b castillonroy remotes/origin/castillonroy
git checkout -b test remotes/origin/test

Developer data

If you want to contribute back to Super Grub Disk repository you need:

  • An developer.berlios.de account
  • Ask adrian15 on Super Grub Disk mailing list to give you permissions
  • Type the following commands on the GIT repository:
git config --add user.name "First Last"                         
git config --add user.email email@domain.com                         
git remote add origin ssh://berliosusername@git.berlios.de/gitroot/supergrub   

How to work with a new feature thanks to a new branch

Select the branch base where you want to work

git checkout baells

Create a new branch based on this one with a meaningful name. In this example we suppose that the new feature is an load grub cfg option.

git checkout -b baells_features_loadgrubcfg baells
Switched to a new branch 'baells_features_loadgrubcfg' 

Improve whatever you have to improve.

git status # If you are not sure about what you have changed (what you have to type in git add)
git add <files that you have added or improved.>
git commit -m "Added Load Grub Cfg Option"

How to work with a build branch to merges "baells (upstream), baellsdeb (debian) and feature/myfeature branches"

Some assumptions:

  • baells branch represents upstream.
  • baellsdeb branch represents the debian directory.
  • baells_features_loadgrubcfg represents a branch with the new feature: load grub cfg

So we want to begin a new branch called_ baells_with_features_build to test this new feature

Let's create a child branch from baells branch and start working here.

git checkout -b baells_with_features_build baells
Switched to a new branch 'baells_with_features_build'

Let's merge the patch branch

git merge baells_features_loadgrubcfg
Updating f7e79df..eb90f69                                                                    
Fast forward                                                                                 
 menus/cfgdetect.lua |   34 ++++++++++++++++++++++++++++++++++                               
 menus/grub.cfg      |    7 +++++--                                                          
 2 files changed, 39 insertions(+), 2 deletions(-)                                           
 create mode 100644 menus/cfgdetect.lua                                                      

And also merge the debian branch

git merge baellsdeb
[...]

That's it. You are ready to build and test your application. After that you should be able to delete your build branch without too much worry.

Advanced. How to create empty branches

git symbolic-ref HEAD refs/heads/newbranch rm .git/index git clean -fdx <do work> git add your files git commit -m 'Initial commit'

Update your local repository with data from the official supergrub git repository

git pull


TODO: How to switch among branches. (git checkout branch) TODO: Advanced. How did I migrate the svn repository. (I had no standard layout). TODO: How to work with topgit so that you can create "generated-patches" branches. TODO: What you should send to the mailing list. (How to generate the email.) TODO: How you can submit back to official supergrub git repository your new feature or improvement. TODO: Svn and GIT. Explain some differeences between them. Branches. Build dirs and so on.



Ref: Empty branches: http://book.git-scm.com/5_creating_new_empty_branches.html Ref: git-doc package: file:///usr/share/doc/git-doc/gittutorial.html Ref: Migrate SVN to GIT: http://unintelligible.org/blog/2008/07/30/migrating-a-subversion-repository-to-a-remote-git-repository/ Ref: General: http://www.kernel.org/pub/software/scm/git-core/docs/user-manual.html