Changes between Version 48 and Version 49 of DeveloperGuidelines/Git
- Timestamp:
- 05/18/12 05:25:07 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/Git
v48 v49 20 20 https://docs.google.com/drawings/d/1TppJKr9Qrq6I2KpkljRixx5gYh1seRqCXk8KDWdeIF0/edit 21 21 === Ongoing Coding === 22 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 23 {{{ 24 cd <mydirectory> 25 26 # Set github.com/flavour/eden as the upstream repository 27 git remote add upstream git://github.com/flavour/eden.git 22 {{{ 23 cd web2py/applications/eden 28 24 29 25 # Update your working directory with latest code from Trunk 30 git fetch upstream 31 git merge upstream/master 32 git checkout -b <mystory> 26 git pull upstream 33 27 34 28 # Write Code 29 30 # Quick review of code (no test code left in, etc) 31 git diff 32 33 # Check for any new files which need adding 34 git status 35 git add. 36 37 # Commit Code (Note, no pushes to GitHub here) 35 38 git commit -am "My Story: Part 1" 36 39 . … … 39 42 git commit -am "My Story: Part N" 40 43 44 # Merge latest Trunk 45 git pull upstream 46 47 # Resolve any conflicts (see below for how) 48 49 # Commit fixed code 50 git add . 51 git commit -a 52 53 # Squash commits to as few as possible to keep revision history clean & make it easier to review the work 54 git rebase -i 55 56 # Push to your branch on GitHub 57 git push 58 }}} 59 60 [[Image(https://docs.google.com/drawings/pub?id=1Vhvm1EmqWOVNZkZsiJ0MLLpdTl6H_ya263Tdb2HK1N0&w=960&h=720)]] 61 https://docs.google.com/drawings/d/1Vhvm1EmqWOVNZkZsiJ0MLLpdTl6H_ya263Tdb2HK1N0/edit 62 63 Once you have pushed to your branch on GitHub, you will likely want this to be merged with Trunk - this should be done via a Pull Request. This is done on GitHub: 64 * https://github.com/mygitusername/eden/pull/new/<mystory>(the branch name) 65 66 [[Image(https://docs.google.com/drawings/pub?id=1QmGeuQvFpg3pDQpM9xu81V7MlVy4uU8EzVIRqQ14MwU&w=792&h=353)]] 67 https://docs.google.com/drawings/d/1QmGeuQvFpg3pDQpM9xu81V7MlVy4uU8EzVIRqQ14MwU/edit 68 69 If you want to adopt the [http://blog.hasmanythrough.com/2008/12/18/agile-git-and-the-story-branch-pattern Story Branch] pattern, which allows pushing interim work to GitHub for review & also allowing contributing quick fixes to Trunk without needing to complete the interim work: 70 {{{ 71 git checkout -b <mystory> 72 73 git commit -a 74 ... 75 git commit -a 76 41 77 # Quick review of code (no test code left in, etc) 42 78 git diff master...HEAD 43 44 # Merge latest Trunk 45 git fetch upstream 46 git merge upstream/master 47 48 # Squash commits to as few as possible to keep revision history clean & make it easier to review the work 49 git rebase -i 50 51 # One more method to squash your commits if they are not in between two executions of git pull or git merge is: 79 }}} 80 81 One more method to squash your commits if they are not in between two executions of git pull or git merge is: 82 {{{ 52 83 git stash 53 84 git reset HEAD@{N} 54 85 git commit -am 'Your commit message for the one-big-commit' 55 git push upstream HEAD(or your-branch/tag-name)86 git push 56 87 git stash pop 57 58 }}} 59 60 [[Image(https://docs.google.com/drawings/pub?id=1Vhvm1EmqWOVNZkZsiJ0MLLpdTl6H_ya263Tdb2HK1N0&w=960&h=720)]] 61 https://docs.google.com/drawings/d/1Vhvm1EmqWOVNZkZsiJ0MLLpdTl6H_ya263Tdb2HK1N0/edit 62 63 Once you have pushed to your branch on GitHub, you will likely want this to be merged with Trunk - this should be done via a Pull Request. This is done on GitHub: 64 * https://github.com/mygitusername/eden/pull/new/<mystory>(the branch name) 65 66 [[Image(https://docs.google.com/drawings/pub?id=1QmGeuQvFpg3pDQpM9xu81V7MlVy4uU8EzVIRqQ14MwU&w=792&h=353)]] 67 https://docs.google.com/drawings/d/1QmGeuQvFpg3pDQpM9xu81V7MlVy4uU8EzVIRqQ14MwU/edit 68 88 }}} 69 89 ==== Resolving Merge Conflicts ==== 70 90 If you encounter conflicts during the rebase, the conflicts will be tagged in the files with: