Development using git
- 1 Basic Git usage
- 2 Cloning the repository via Git
- 3 General GIT Workflow
- 4 List the local branch
- 5 List your local non committed changes
- 6 Commit
- 7 List your commits
- 8 Keeping your local working branch in sync
- 9 Documentation about git
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.
Using git config without --global let you configure other details for a specific git repository.
To be able send your commits (patches) via email you need configure an SMTP server.
For sending from a gmail address you can do:
Optionally, it is possible to skip the password prompt by adding it to the configuration with:
To reset CC mail attribute
[user] email = email@example.com name = Your Name [core] editor = nano pager = less -FXRS [sendemail] from = Your Name <firstname.lastname@example.org> smtpuser = email@example.com smtpserver = smtp.googlemail.com smtpencryption = tls smtpserverport = 587 suppresscc = self [push] default = simple
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.
If you want only the last 3 revisions:
Use the command below to see the full log of the trunk.
With write access
If you have write access to the Alpine the URL needs to be adjusted for cloning a repository
General GIT Workflow
- Make your file edits in your local checkout of the local copy of repository.
- git commit the changes in your local repository
- git pull --rebase to bring the rest of your local repository up to date
- git log origin..master to check what you are going to commit
- git push to move your changes up to the master. This requires you have an ssh login and have cloned via ssh://git.alpinelinux.org and not via git://git.alpinelinux.org. (see Development using git with write access)
if you want to "hide" your changes. Do this if you think there may be other commits against the same things you are working on and want to refresh your local checkout (using a git pull --rebase) from the master. Use git stash apply to get your stash back.
if you think your tree is pretty hopeless, need a kill-and-fill to bring the master into your local repository. You will lose local changes.
List the local branch
You can now list your local branch by doing
which should ouput
List your local non committed changes
Now you can start to work on your tree. As soon as you feel you have reached a step in development where you can commit your work locally, use
If you wish to give credit to someone else's work (e.g. you are applying a third party patch):
The format of the commit message should be:
One-line descrption thats less than 72 chars long <second line empty> Optional longer description with explanation why changes were made. Links to relevant issues in bugtracker can be done with: ref #<issuenumber> It is also possible to resolve issues with: fixes #<issuenumber>
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.
List your commits
Keeping your local working branch in sync
Pull the changes from upstream (git.alpinelinux.org)
Documentation about git
Some other useful documents