I was asked a question today about what was the difference between POST and PUT when referring to HTTP.
There seems to be some confusion over what people understand it to be; it is quite simple, just to avoid any confusion here is the RFC itself explains the core difference:
The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request — the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.
Source control packages always have been a bit of a pain when you first start using them. You may know the principles of source control. Each environment has its own way and definitions and its own processes. Once you are used to using a source control system and the steps you follow it is easy. I call this the Source Control shuffle.
It’s always good to have a workflow that allows for code review and this process below will provide a method to do this by using branches and merging back into the master.
The branching, committing and merging workflow for projects using git source control.
master is always production ready and suitable for deployment
- create a new branch for every feature or fix
- on each branch, NEVER work on anything but the specific task related to it. If you see other work that needs doing during the course of development, submit a ticket for it, or check out a new branch.
rebase during feature development, explicit (
merge when complete.
Feature Process (or the shuffle)
New features that are added to the product for a future release.
N.B. bug fixes that should go into the next feature release, rather than a hotfix, should also use this process.
Pull down the latest changes from
git checkout master
git fetch origin
git merge master
- Create a new branch for the work. Use the issue key followed by a descriptive name for the branch.
git checkout -b PRJ-123-feature-name
- Work on the feature.
- Make regular commits
- Avoid clustering changes together.
- Push to remote as needed, to keep a backup of your work.
- If you need to work on another task, ensure all changes are committed before creating a new branch or switch to another one.
- Only one developer should work on a feature branch. If more than one developer needs to work on the task, each should branch off again (including the first developer to start work) from the shared branch. Merges should be made to the task branch as per the central workflow.
Keep your branch up to date with the latest changes on
git fetch origin
git rebase origin
When ready for feedback and/or code review, push to remote and create a pull request.
Push to remote:
git push -u origin PRJ-123-feature-name
- Create a pull request on VSTS to merge the feature branch into
- Code review should now occur. If changes are required, they can be committed and pushed to the same branch. The pull request will be automatically updated with any new commits.
N.B. Any changes made from now on should occur using merges only. If
master needs to be merged into the branch to update it, you should not use
rebase, as this will cause problems with the pull request.
Once the review is complete, perform a final
rebase (see Feature Process above) to prepare to
merge. Then push to remote again (see 5.a above).
- The pull request should now be completed on VSTS. This will create a merge commit. There should be no actual changes or conflicts in this commit if the previous procedures have been followed correctly.
- Delete the feature branch. This is an option on the remote during the pull request completion in VSTS. The branch will also need to be deleted locally by the developer:
git branch -d PRJ-123-feature-name
Bug fixes that need to be applied to the currently released version (or to patch a previous version that is still supported) and require a new patch version release.
- Pull down the latest changes from
master (see Feature Process 1. above).
Check out the tag of the release you want to hotfix, branch from it and check out the new branch:
- Work on the bug fix, following the notes in Feature Process 3.
N.B. It is important that you DO NOT follow step 4. of Feature Process, as changes from
master should not be brought into your hotfix branch.
- When ready for feedback and/or code review, push to remote.
N.B. DO NOT create a pull request to
- Follow the Release Process, using the hotfix branch instead of a release branch.
N.B. hotfix/patch releases should contain just one bug fix.
This process starts when preparing to make a release after all code tasks for that release are merged into
master. Final work may still be necessary to complete the release.
- Create a new branch from,
master either in git directly, or locally, having first pulled the latest changes from master. If you create the branch locally, the currently checked out branch will be used to branch from.
- The branch should be named release with the version number appended, e.g.
This marks the point at which no more features will be added to the release. Only adjustments and bug fixes necessary to put the release into production should be applied to this branch.
However, work can continue on new features for other releases, by branching off,
master as covered above.
- Any further work to prepare this release should be merged into this release branch, using the same process as Feature Process, but creating pull requests to and rebasing from the release branch, instead of master.
Once the release is ready, update the assembly version in the release branch to match Jira and commit, then deploy the build via the deployment machine – this will usually involve checking out the new release branch, running the grunt script to grab the correct web configs and log4net configs and then deploying from Visual Studio.
- Note that the version number as reported in the health check will always have 4 digits even though we are only using 3.
Create a tag on the release branch once you are happy that the release was successful
- Merge the release into master after the release has been tested and is finished: If there are any errors with the release, a decision will need to be made by the Development Manager whether to fix the release branch or to revert the release and do it again.
- Merging back into master should be done with a pull request on git.
- The release branch can now be deleted.