Development using 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 user.name "Your Name Comes Here" git config --global user.email firstname.lastname@example.org
To get started, clone the git repository for the package you are interested in:
git clone git://git.alpinelinux.org/alpine-baselayout git clone git://git.alpinelinux.org/alpine-conf
Make your changes.
To prepare a patch:
git diff > short-description-of-change.patch
This diff can be sent to email@example.com 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.
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:
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:
To commit the change do:
git add hello.txt git commit -v
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 git.alpinelinux.org
make a 'bare' copy of your git repository.
cd .. git clone --bare myproj myrepo.git
Copy that to git.alpinelinux.org. You need an ssh account for this.
scp -r myproj.git git.alpinelinux.org:
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 git.alpinelinux.org. First you have to remove the old myproj directory. Then you clone it with ssh.
mv myproj myproj.backup git clone ssh://git.alpinelinux.org/~/myproj.git
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:
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 <firstname.lastname@example.org>" > users.txt
Create a temp work area.
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://svn.alpinelinux.org/proj --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.
Now we can create a bare repository and upload it to dev.alpinelinux.org/gitroot.
cd .. git clone --bare proj-tmp proj.git scp -r proj.git dev.alpinelinux.org:/gitroot
Some useful documents