wiki:GitGuideLines
Last modified 7 years ago Last modified on 10/29/09 13:16:31

GitGuideLines

As we are several developers who works activly on Midnight Commander we need a very specific layout so that we always know which fix belongs to which branch and who is reponsible.

At first please check out the git repository:

  git clone ssh://midnight-commander.org:22/git/mc.git

Now you can start to prepare this repository in order to track all remote branches in local ones:

  git branch -r                                                   

Will list you all remote branches which are currently available:

  winnie@energy:~/dev/mc$ git branch -r                           
  origin/10_fish_stalls_on_symlink                                
  origin/125-allocate-and-free-memory-via-wrapper                 
  origin/133_obsolete_autoconf_macros                             
  origin/142_debian_files_syntax                                  
  origin/144_procmail_syntax                                      
  origin/147_escaping                                             
  origin/151_fix_uninitialised_var_edit.c                         
  origin/155_remove_WANT_WIDGETS                                  
  origin/16_syntax_differ_c_and_cpp                               
  origin/65_additional_delphi_keywords                            
  origin/HEAD                                                     
  origin/master                                                   
  origin/mc-4.6                                                   
  origin/mc-ru-fork                                               
  origin/utf-8                                                    
  winnie@energy:~/dev/mc$                                         

You see, this is quite much and the number of branches will certainly grow further. As remote branches are not interesting for developing you certainly want to set up some local branches in order to track there the changes of the remote branches:

  git checkout origin/65_additional_delphi_keywords -b 65_additional_delphi_keywords

Of course you can also choose another name for your local branch, but choosing the same as used remote makes the most sense. Okay.. fine.. now you should see all local branches:

  winnie@energy:~/dev/mc$ git branch                                    
  10_fish_stalls_on_symlink                                             
  125-allocate-and-free-memory-via-wrapper                              
  133_obsolete_autoconf_macros                                          
  142_debian_files_syntax                                               
  144_procmail_syntax                                                   
  147_escaping                                                          
  151_fix_uninitialised_var_edit.c                                      
* 155_remove_WANT_WIDGETS                                               
  16_syntax_differ_c_and_cpp                                            
  65_additional_delphi_keywords                                         
  master                                                                
  mc-4.6                                                                
  mc-ru-fork                                                            
  utf-8                                                                 
winnie@energy:~/dev/mc$                                                 

The "*" marks the branch you are currently in. To switch between branches simply use: git checkout $branchname.

  winnie@energy:~/dev/mc$ git checkout master                           
  Switched to branch "master"
  winnie@energy:~/dev/mc$

Now you are in the branch "master".

Pleae note that everytime before you start to work on something, please update your local checkout:

  git pull

If there was nothing new you'll see this output

  Already up-to-date.

otherwise something like this:

  remote: Counting objects: 27, done.
  remote: Compressing objects: 100% (10/10), done.
  remote: Total 10 (delta 8), reused 0 (delta 0)
  Unpacking objects: 100% (10/10), done.        
  From ssh://midnight-commander.org:22/git/mc 
     6f8a3b3..8ebe787  151_fix_uninitialised_var_edit.c -> origin/151_fix_uninitialised_var_edit.c
     aeec284..f2f8ef4  master     -> origin/master

Okay, fine. Now you are able to track changes, in your local repository and to update it. But in order to use it activly there are plenty more options... If you are only intrested in tracking the development you can stop here.. but if you are intrested in active development together with us, please read further.