Changes between Version 4 and Version 5 of WorkingWithGit

06/13/08 21:06:43 (7 years ago)



  • WorkingWithGit

    v4 v5  
    1313Unlike 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 
    15 git commit  
     15{{{ git commit }}} 
    1717will make changes only to the local repository, unlike cvs. 
    2121This is the easiest step, since all you need to do (as root) is 
    23 yum install git-all 
     23{{{ yum install git-all }}} 
    2525which will install the basic git commands as well as some useful extras (like simple gui that helps managing your git repository). 
    2929Now 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 
    31 git clone ssh:// 
     31{{{ git clone ssh:// }}} 
    3333which 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. 
    3535''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 
    37 git clone git:// 
     37{{{ git clone git:// }}} 
    3939== Setting up local branches == 
    4343First go to the echo-icon-theme directory you just git-cloned and issue 
    45 git gui 
     45{{{ git gui }}} 
    4747A 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. 
     55Now 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: 
     59        repositoryformatversion = 0 
     60        filemode = true 
     61        bare = false 
     62        logallrefupdates = true 
     63[remote "origin"] 
     64        url = ssh:// 
     65        fetch = +refs/heads/*:refs/remotes/origin/* 
     66[branch "master"] 
     67        remote = origin 
     68        merge = refs/heads/master 
     71Now add there a new branch section following the example of master branch. In our example the final config file will look like this: 
     75        repositoryformatversion = 0 
     76        filemode = true 
     77        bare = false 
     78        logallrefupdates = true 
     79[remote "origin"] 
     80        url = ssh:// 
     81        fetch = +refs/heads/*:refs/remotes/origin/* 
     82[branch "master"] 
     83        remote = origin 
     84        merge = refs/heads/master 
     85[branch "0.3.x"] 
     86        remote = origin 
     87        merge = refs/heads/0.3.x 
    5590== Switching between branches ==