Git

From Alpine Linux

This document describes how to use git for Alpine Linux development and related projects. If you just want to browse the Alpine git repositories, please visit cgit.

Basic Git usage

Configure your global git config

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 you@yourdomain.example.com

Using git config without --global let you configure other details for a specific git repository.

Tip: If you want to use git with colored output use:

git config --global color.ui true

Development using git:Email

Cloning the repository via Git

There are two ways to work with the Alpine git repository...

  • ...without write access.
  • ...with write access.

Without write access

cgit shows all available Alpine git repositories. If you want to clone the Alpine aports repository, switch to the directory you want to have the aports/ directory in and launch git.

git clone git://git.alpinelinux.org/aports.git

If you want only the last 3 revisions:

git clone git://git.alpinelinux.org/aports.git --depth 3

Use the command below to see the full log of the trunk.

git log

With write access

If you have write access to the Alpine the URL needs to be adjusted for cloning a repository

git clone ssh://username@git.alpinelinux.org/aports.git

General GIT Workflow

  1. Make your file edits in your local checkout of the local copy of repository.
  2. Commit the changes in your local repository:

    git commit

  3. Bring the rest of your local repository up to date:

    git pull --rebase

  4. Check what you are going to commit:

    git log origin..master

  5. Move your changes up to the master if you have write access

    git push

    or create a patch if not.

Git Push (Distributed Workflows)

If working with Distributed Workflows you would 'pull' from public repo, 'push' to another publically accessable repo (where you have write access), main developer (who has write access to public repo) 'pulls' you changes from your pub.accessed.repo into the public repo.

To make it easier for you to work, you can configure 'git push' to push your work to your publically accessable repo ('git pull' would still pull from same repo as you cloned from).

cd /your/private/repo/where/you/work/reponame git config remote.origin.pushurl "ssh://user@dev.alpinelinux/home/user/cgit/reponame.git"

Now 'git pull' pulls the public repo, and 'git push' pushes to your public repo.

Note: The path where you want to push to should first be prepared with 'git clone --bare ...' as described below in section 'Upload the new project'

Other related articles