wiki:GitHowto
Last modified 13 years ago Last modified on 01/04/09 21:44:34

Small Howto use our Git Repro

Geting repro

Developer

At first: Every developer should check out the git repository via ssh.. as every other possibility is readonly:

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

Anonymous R/O access

  git clone http://git.midnight-commander.org/mc.git

or

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

Some info about current repro

There are now several branches, namely:

  • master (testing area)
  • stable (from this branch we do the releases, only stable code)
  • mc-ru-fork (code from a former fork, which should be integrated)
  • utf-8 (a utf8 patch applied)

Our workflow is splitted up in four parts:

  • Creating the patch
  • Discussing the patch
  • Applying the patch to master
  • Moving the patch after testing to stable

Creating the patch

There are two possible ways in order to create a patch:

Way 1

  • create a local branch on top of master:
        git checkout -b foobar #if you are on master
    
  • Do some work inside this branch.
  • Have a look what has changed really:
        git status
    
  • Add all files which shoul go into the patch in order to track them:
        git add src/file1.c po/file2.po maint/file3.txt
    
  • Create a diff against master:
        git diff master > /tmp/newpatch.patch
    
  • Delete everything which was done:
        git reset --hard $sha_of_last_usefull_commit
    
    Using here --soft will also work but then you'll have to delete the untracked stuff on your own
  • Check if something is still there which shouldn't be there
        git status
    
  • Switch back to master and delete the foobar branch
    git checkout master 
    git branch -d foobar
    

Way 2

  • Do some work in the master branch
  • Add all files which should show up in the diff into the stagging area
        git add file1 file2 file3
    
  • Create patchfile:
        git diff master > /tmp/patchfile.patch
    
  • Reset master to last usefull commit:
        git reset --hard $sha_of_last_usefull_commit
    
  • Check if something is still there which shouldn't be there
        git status
    

Discussing the patch

As a patch should always be build on master it should be fairly trivial to test if the patch is okay (applies): For this only fetch the patch and apply it on master (or on a foobar branch for testing). Maybe test if the patch behaves as expected and read through the patch if the coding style and the changes itself are good. After that comment on the ticket if the patch is okay or should reworked.

Afterwards you can clean up again the master branch with

git reset --hard $sha_of_last_usefull_commit

Applying the patch on master

There are a lot of other possibilities in order to create patches/work on the git but I would suggest that you try it on your own ;-)