Improving Git workflow and optimization for PHP [magento] -


background information

we working shift using svn git, work on magento stores , have staging server , production server every project.

the process in simple terms: code first developed on local machine project setup on every dev machine, committed staging repo , tested client , qa , master goes production , final testing qa.

we use codebase/github repositories , deployment staging automatic using deployhq , deployment master production done sys admins using deployhq.

the git workflow has been derived after being influenced different workflows suggested on internet , uses chunks of http://nvie.com/posts/a-successful-git-branching-model/ , proper way use git/github - php system dev/testing/production servers along others includes commands think consistent model.

git workflow

0] setting new git project locally

  • git clone [path_to_repo] -b [branch_name] [local_dir]
  • path_to_repo can either remote repository or branch bundle (repo.bundle)

1] setting remote path in case of bundle import

  • git remote set-url origin [path_to_repo]
  • path_to_repo remote repository

2] create new feature branch based on tasks assigned.

  • git checkout -b [branch_name] // create new branch , switch it
  • git push origin [branch_name]

3] changes done locally in local branch , pushed remote branch periodically (in batches, not single change!) if wants work on same branch, needs pull data same remote branch not master.

  • daily routine
  • git checkout [branch_name] // switch branch
  • git pull // pull latest changes remote (e.g. in morning before start working)
  • make changes in files
  • git add . or git add [folder] // prepare list of files committed or file/folder
  • git commit // commit changes local branch
  • git pull // pre-push sync @ end of day become aware of conflicts
  • git push // push changes remote branch @ end of day

4] once changes in remote/local branch working , need reviewed on staging server local branch merged remote staging branch.

  • git checkout staging // if exist switch it
  • git merge [remote_branch_to_merge_to_master]
  • git push

5] if client confirms remote branch working fine , ready deployed live server, merge master

  • merging master
  • git checkout [master_branch_name] // switch master
  • git pull origin/master
  • git merge [remote_branch_name_to_merge_to_master] // merge master
  • git push

master production done through deployhq manually sys admins.

q] should there branch production based on master , changes master going live right away i.e. stable code or redundant.

we looking suggestions on reducing number of steps , if workflow consistent best practices in git including commands mentioned it.

one of ways it:

there 3 main branches: master (development), staging , production. staging , dev deployed automatically via git post-receive hook , bash scripts, production deployed tech lead manually running deploy script.

work done on master, without pushing until feature complete (unless feature complex , drastically changes lot of things). developer tests feature on dev site (build script launched after every push), sends feature qa department (if have one), after qa people done coder sends work code review tech lead, client approves work on dev.

once in x days master merged in staging, qa runs thru staging, client confirms features second time.

after issues confirmed in staging, staging merged in production , production branch deployed live.

p.s: 3 environments hosted on different machines, staging , production have exact same configuration, dev doesn't have strictly follow every live server config tweak - can have 1 machine dev sites.

important p.p.s: in order have work in 1 branch need use issue tracking system , specify issue number in every related commit.

p.p.p.s: using pull --rebase instead of pull keeps git history cleaner , easier read.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -