Вы находитесь на странице: 1из 3

Agile Git Workflow

Feature Development
While in the master branch (git checkout master), pull in the most recent changes: git pull [origin master] Checkout a branch, named with issue ID and a short, descriptive title: git checkout -b prj-123-hello-world (only lowercase letters, numbers, and dashes) Commit your changes at least once a day: git add README git commit -m 'Say hello.' git add README git commit -m 'Say hello to John.' Rebase against the upstream frequently to prevent your branch diverging significantly: git fetch origin master git rebase origin master or git pull --rebase origin master

Push local branch to the upstream before leaving the office: git push -u [prj-123-hello-world] Squash all the commits together via interactive rebase: git rebase -i origin/master Using the editor, squash all the commits except the oldest (first in the editor) one: pick e4c1b61 Say hello. squash c281b81 Say hello to John.

Save and close the editor. Modify the final comment to include the issue ID and all the previous comments: PRJ-123 Hello World * Say hello. * Say hello to John. Merge your changes to back into master: git checkout master git merge prj-123-hello-world Push your changes to the upstream: git push [origin master]

Release Management
While in the master branch (git checkout master), pull in the most recent changes: git pull [origin master] Create a tag the with the current date: git tag v`date "+%Y%m%d"` Push the tag to the upstream: git push --tags Copy the files to all production servers: rsync -avz --exclude=.git . prd1:/var/www/html/ rsync -avz --exclude=.git . prd2:/var/www/html/

Hotfix Development & Release


Checkout the latest release tag from the upstream as a release branch: git checkout 20110823 origin/v20110823 Fix the bug and commit the changes: git add README git commit -m 'Hotfix for the say hello issue.' Push the release branch to the upstream: git push [origin 20110823] Create a tag the with the current date and time: git tag v`date "+%Y%m%d%H%M"` Push the tag to the upstream: git push --tags Copy the files to all production servers: rsync -avz --exclude=.git . prd1:/var/www/html/ rsync -avz --exclude=.git . prd2:/var/www/html/ While in the master branch (git checkout master), pull the most recent changes: git pull [origin master] Rebase againts the latest release branch: git rebase origin 20110823

Вам также может понравиться