IPFire-Logo
  wiki.ipfire.org
  en:development:git
 

Git Howto

Git is the central place of the project. Inside this repository we store all changes of the source code.

See our gitweb: http://git.ipfire.org/

Workflow

With IPFire-3.x we introduce a new workflow for development. From now on, each developer has got his own sandbox that is published on git.ipfire.org. In this sandbox one can do whatever one imagines. When a new feature is developed it will get finished in this sandbox or branch while it can be shared by many developers through the magic of git. After that, it is merged to the master repository.

Inital creation

If you have got an own developer account you should connect the master repository together with you own.

git clone ssh://<user>@git.ipfire.org/pub/git/ipfire-3.x.git # Could also be checked out via the git protocol
cd ipfire-3.x/
git remote add <user> ssh://<user>@git.ipfire.org/pub/git/people/<user>/ipfire-3.x.git

Some general rules:

  1. Never commit anything to master. This branch should always be clean and untouched.
  2. Create an own branch for every feature or bug you aim to develop or fix.
    • git checkout -b my_new_cool_feature
  3. Never send a pull request when a feature is not stable or tested very well.
  4. To get feedback from other developers share your branch, receive reviews, patches, etc.

Configuration

At first you have to introduce yourself to git. That means we tell it our name and mail address. (Please use your @ipfire.org-address!)

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com

If you want a colourfull output ( which is better to overview ) can use the following command:

git config --global color.ui auto

Commands of the repositories

Here I want to advise you to a Howto at http://git.or.cz/course/svn.html , which composes the commands of SVN and Git.

Checkout of the source

For users the haven't got an developer account:

git clone git://git.ipfire.org/ipfire-2.x.git
git clone git://git.ipfire.org/ipfire-3.x.git

For all IPFire-Developers it is commended to transfer the files over their SSH-Access:

git clone ssh://username@git.ipfire.org/pub/git/ipfire-2.x.git ipfire-2.x
git clone ssh://username@git.ipfire.org/pub/git/ipfire-3.x.git ipfire-3.x

If you want to checkout a specific branch of a developer:

git clone ssh://yourusername@git.ipfire.org/pub/git/people/<user>/ipfire-3.x.git

Commit

A commit is a permanent save of all changes. Before all changes should be checked carefully. May ./make.sh git diff helps you.

There are to alternatives to do a commit:

./make.sh git commit -a

This command will commit all changed files inside the repository. If you don't want that you can do the following:

git add make.sh
./make.sh git commit

Now only the files which are specified by git add <filename> will be commited. (At this example make.sh). After every commit, the script will ask you if you also want to push. More about that downside.

Pushing

Git is a shared SCM and also allows offline commits, all commits will be written locally. But some developer have access to the public repository at http://git.ipfire.org. To publish your local commits you have to push them. You can do that with a simple “y” at the friendly question after a commit or with

./make.sh git push

manually. With this command all changes will be written to the public repository.

Pulling

To recieve changes from the public repository of all the other developers you need the following command.

./make.sh git pull

Check that you are inside the clan master-Branch.

Adding of Files

git add <filename>

adds a file to the SCM. Also files can be marked for a commit. ( see this a few lines above ).

Moving of Files

git mv <old-filename> <new-filename>

Removing of Files

git rm <filename>

Create / Merge Branches

Git can contain more than one branche at the same time. To create an parallel one to your existing “master branch” just do a simple:

git branch name

To switch between your branches do a:

git checkout branchname

To include your changes from any branch into the “master branch”, you have to merge them. This can be done with:

git merge branchname

Links

en/development/git.txt · Last modified: 2010/03/13 16:45 by Stevee
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki