Development using git

From Alpine Linux
Revision as of 14:26, 9 September 2009 by Ncopa (talk | contribs) (added note on how to submit a new proj to git.a.o)
Jump to: navigation, search

Git is now being used for version control of the alpine-baselayout and alpine-conf packages.

Configuring git

First you need to tell your name and email to git. This name and email will show up in all your commits.

git config --global "Your Name Comes Here"
git config --global

Git Clone

To get started, clone the git repository for the package you are interested in:

 git clone git://
 git clone git://

Make your changes.

To prepare a patch:

git diff > short-description-of-change.patch

This diff can be sent to mailing list.

Create new git repository for a new project

Start with creating a new directory. In this example the project will be named myproj.

mkdir myproj
cd myproj

Lets initialize the git repository. This will create the .git dir.

git init

Now create the initial files you want. In this example we just create hello.txt

echo "hello git" > hello.txt

We add this to the git "index" and commit it. The -v option shows the diff as a last reiew. Your $EDITOR will be opened and you will need to create a description of the initial commit.

git add hello.txt
git commit -v

The format of the commit message should be:

[first line]One-line descrption thats les than 72 chars long
[second line empty]
[third line]longer description.

Think of first line as the subject in an email and the third line and on as the body of the email, describing what the commit does. You dont need the long description but the first line, the short description should be there as it will be showed in the commit log.

Now you can see the initial commit with:

git log

Make some more changes. In this example we just append some text to hello.txt

echo "hello again" >> hello.txt

To check what you have done since last commit use:

git log

To commit the change do:

git add hello.txt
git commit -v

or alternatively:

git commit -a -v

The separate git add is useful when you ave changed many files but just want commit some of the changed files.

Publish the new repo to

make a 'bare' copy of your git repository.

cd ..
git clone --bare myproj myrepo.git

Copy that to You need an ssh account for this.

scp -r myproj.git

Send an email to Natanael Copa (or ping him on irc) to make a symlink of it to /gitroot on and to make it visible from cgit.

Now you can clone the remote repository from First you have to remove the old myproj directory. Then you clone it with ssh.

mv myproj myproj.backup
git clone ssh://

Now you have a local copy of the remote repository in myproj/ directory. You can make changes there as much as you want. You can make commits, tags, undo/redo commits/tags (thats not pushed). You can do that without even having internet access. When you want to submit your changes (all you commits since last pull) you do:

git push

Migrate a subversion repository to git

Start with creating a users.txt file where the svn users are mapped to an email address for git.

echo "ncopa = Natanael Copa <>" > users.txt

Create a temp work area.

mkdir proj-tmp

Init the git repository. If your svn repo does not have the standard trunk branches and tags dirs you shouldnt use the --stdlayout. You can also use -T trunk -b branches -t tags.

cd proj-tmp
git svn init svn:// --stdlayout

Connect the users.txt to the empty git repository so users are remapped.

git config svn.authorsfile ../users.txt

Fetch and import the svn repository. This might take some time.

git fetch

Now we can create a bare repository and upload it to

cd ..
git clone --bare proj-tmp proj.git
scp -r proj.git


Some useful documents