Icecast Server/Git workflow
Icecast recently migrated to Git instead of SVN, this page outlines how to get started with it!
Cloning the Repo
First you need to clone the Git repository, because we use submodules, these should also be cloned, do to this, run:
git clone --recursive ssh://git@git.xiph.org/icecast/icecast.git
If your Git version (git --version
) is lower then 1.6.5, do:
git clone ssh://git@git.xiph.org/icecast/icecast.git
cd icecast
git submodule update --init
Initializing the Submodules
The steps above we did for cloning already initialized the Submodules, but if you want to do any changes to them later and push them back to the remote repository, we need to configure some things.
First of all, checkout the master branch, depending on your git version, your modules may be initialized in a detached HEAD state.
git submodule foreach git checkout master
(If your git version does not support this, cd
into each submodule and run git checkout master
)
Pushing changes to a remote Server
When you are done with some super cool new feature, or even while working on it, you may want to push your current state to the remote repository, so others can test it and give you some Feedback! For this example let's assume you've built an ACL, therefore changed something in httpp.c which is in the common submodule and changed a lot of stuff in parent repository.
First you need to commit the changed you made in the common submodule, so cd
into it, and do
git status
This will list you the changes you made, each change you want to have in the commit needs to be added, let's assume (which is the most common case) you want to commit all changes.
You could either do git add .
or even shorter:
git commit -a
The -a
or --all
option will add all changed or deleted files, but not add any untracked files.
Now enter a meaningful commit message, the first line should be a rough summary, followed by two newlines and a more verbose description. Less is not more in this case, that’s what the summary is for.
Ok now it's time to push the changes to the remote server, if this is the first time you do this, you might need to set the origin url, because it defaults to a http(s) one, so that people without ssh access can clone the repository and submodules too, but for cloning you want to use ssh. Let’s set the remote origin like this:
git remote set-url origin ssh://git@git.xiph.org/icecast/common.git
Now push the changes to the remote location:
git push origin master
This tells git to push your copy of the master branch to the remote location origin (that we’ve just set to the right url).
Ok now that we cared about the submodule, let's cd
back into the parent repository, and commit the changes we made there:
git commit -a
Now enter a meaningful commit message. (Yes, I sound like a broken record, but this is important)
Push the stuff to the remote:
git push origin master
(If you are on a different branch than master, you probably want to replace master with the branch you are on, obviously, or just do git push
)
NOTE: Even if you hadn't changed anything in the parent repository but just in the submodule repository, you would need to commit the change of the version of the submodule to the parent repository. If you just had updated the httpp.c you still would needed to do git commit -a -m "Update commons to recent version for latest httpp changes"
, and push it, to make the parent repository point to the right submodule version.
Updating the repository
Let's say someone else committed something and pushed it, and you want to update your local copy to the one of the remote. Let's assume you have nothing changed, so you are just a bit behind in history, then it is a simple as:
git pull
and
git submodule update
to make sure submodules are up to date too.