= Git = [[TOC]] Sahana Eden has decided to move from !Bzr/LaunchPad to !Git/GitHub == Why? == * The current repository is huge & bloated, taking too long to download. * Even simple changes take an age to Pull down to servers * Web2py no longer supports !Bzr/LaunchPad, so we want to be able to maintain a common tool to work with both repositories. * New developers are likely to be more familiar with !Git/GitHub == How? == The preferred approach is to have a clean repository, in order to get the maximum benefit from the migration...although it is technically possible to [http://fearthecowboy.com/2011/04/29/converting-bazaar-repositories-to-git/ migrate the commit history]. Commit History will instead be maintained on the !LaunchPad site as an archive === Migrating existing Branches === Merge branch with trunk using normal Bzr tools Assuming that you have already [https://github.com/flavour/eden/fork_select forked Eden Trunk], then you will need to create a new repository manually for additional branches, as you cannot [http://bitdrift.com/post/4534738938/fork-your-own-project-on-github fork your own project on GitHub]: * https://github.com/repositories/new {{{ cd web2py/applications git clone git@github.com:flavour/eden.git 2 }}} * Move {{{.git}}} & {{{.gitignore}}} from 2 to * Delete the rest of 2 * Edit {{{.git/config}}}: {{{ [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@github.com:/.git }}} * Copy all the contents from into {{{ cd git add . git commit -am "Initial Git version of My branch" git push -u origin master git remote add upstream git://github.com/flavour/eden.git }}} === Developer Workflow === We suggest adopting the [http://blog.hasmanythrough.com/2008/12/18/agile-git-and-the-story-branch-pattern Story Branch] pattern, which allows squashing commits in order to keep the main Trunk as clean as possible {{{ cd # Update your working directory with latest code from Trunk git pull upstream master git checkout -b git commit -am "My Story" # Quick review of code (no test code left in, etc) git diff master # Merge latest Trunk git checkout master git pull git checkout git rebase master # Push to your branch on GitHub git checkout master git merge git push # Cleanup git branch -d }}} To resolve merge conflicts, you can create the .THIS & .OTHER files using: {{{ git show :2:file.txt > file.txt.THIS git show :3:file.txt > file.txt.OTHER }}} Although on Windows this seems by default to produce UTF-16 files! ('UCS-2 Little Endian'). A script to make this process easier for Windows users is attached: merge.cmd === Developer Configuration === {{{ git config --global user.name "Your Name" git config --global user.email your@email.com git config --global github.user yourgithubusername git config --global github.token yourtoken git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" git config --global merge.tool diffmerge git config --global diff.tool diffmerge git config --global difftool.diffmerge.cmd 'C:/Program Files (x86)/Git/etc/wrappers/git-diff-diffmerge-wrapper.sh' "$LOCAL" "$REMOTE" git config --global difftool.prompt false git config --global merge.tool diffmerge git config --global mergetool.diffmerge.cmd 'C:/Program Files (x86)/Git/etc/wrappers/git-merge-diffmerge-wrapper.sh' "$PWD/$LOCAL" "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$MERGED" git config --global mergetool.prompt false git config --global mergetool.trustExitCode false git config --global mergetool.keepBackup false }}} ==== Windows ==== Install [http://sourceforge.net/projects/console/ Console] & [http://www.sourcegear.com/diffmerge/downloads.php Diffmerge] & [http://markembling.info/2009/09/my-ideal-powershell-prompt-with-git-integration configure Powershell]. === Developer Tools === {{{.gitattributes}}} runs {{{version.py}}} to update the {{{VERSION}}} file on commit Possibly we could add a pre-commit hook to run tests, e.g. based on http://tech.yipit.com/2011/11/16/183772396/ or http://blog.penzilla.net/2011/09/git-pre-commit-hook-for-python-now-with.html == Resources == * Community Book: http://book.git-scm.com * Tips & Tricks: http://gitready.com