wiki:WorkingWithGit

Version 5 (modified by mso, 6 years ago) (diff)

--

WORK IN PROGRESS

Working with Git

Proword

Echo utilises a modern Source Control Management (further only SCM) tool called git. It's quite powerful and has a lot of futures and thus may seem a little hard to work with from the start. That's why we provide this simple guide how-to work with echo-icon-theme's git repository.

Some basics

Unlike some other SCM like cvs or svn, git is sort of decentralised since you work locally with full-featured repository in which you can even have local development branches, etc. That means you can do many changes to the repository when working offline and than just push the changes to the master repository, but it also means that

git commit

will make changes only to the local repository, unlike cvs.

Installing git

This is the easiest step, since all you need to do (as root) is

yum install git-all

which will install the basic git commands as well as some useful extras (like simple gui that helps managing your git repository).

Copying the master repository

Now that you've set up git, you need to copy the master repository so that you can make changes locally. In order to do so, navigate into a folder you'd like to keep your echo-icon-theme git repository in and issue

git clone ssh://git.fedorahosted.org/git/echo-icon-theme

which will make a exact copy of the master repository in your disk. After the repository is cloned, you can start browsing - it has normal directory structure and the only directory that has something to do with git, is the hidden .git directory.

Note: The command above expects that you have a working fedora account and you are member of gitecho-icon-theme group. We use this one, because it simplifies life a little more after you want to push your changes back to master repository - the ssh access is read & write. If you don't need to push your changes back or you don't have ssh access, you can use

git clone git://git.fedoraproject.org/echo-icon-theme

Setting up local branches

Apart from master branch we also keep stable branches (for updates to stable echo-icon-theme releases) that can have different conent than the master branch. One of such branches is 0.3.x. On it we will show you an example how to set up a local branch that's keeped in sync with the remote one.

First go to the echo-icon-theme directory you just git-cloned and issue

git gui

A not so nice, but pretty usable app shows up ;-) You can even do your commits from there. But not yet. Now go to Repository -> Visualise All Branch History. Another window shows up. Try to play with it a little, if you screw up your repository, you can always start from scratch by deleting it and cloning it again (or restoring it from a backup copy, if you had done any). After you feel comfortable with it, find a branch you want to track localy (master branch is already tracked by default) - as an example we use 0.3.x. Right-click on the commit message and select Create new branch, as shown in the example image.

A pup-up windows appear. Fill in the branch name. It does not necessary need to be same like the remote branch name, but it is more convenient. See the example image.

Now you need to tell git to synchronise your branch with the remote one. Go to .git folder and open the config file in there. It should look similar to that:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = ssh://git.fedorahosted.org/git/echo-icon-theme
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master

Now add there a new branch section following the example of master branch. In our example the final config file will look like this:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = ssh://git.fedorahosted.org/git/echo-icon-theme
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[branch "0.3.x"]
	remote = origin
	merge = refs/heads/0.3.x

Switching between branches

Keeping your local repo in sync

Commiting your changes

Pushing your changes to fedorahosted.org

Learning more

Attachments