Git is a free and open sourcedistributed version control system. VCS is a software that helps software developers to work together and maintain a complete history of their work. It is highly expected to follow standard coding practises but the code revisioning claims equal importance than maintaining the standards.
Let’s discuss a standard flow of maintaining the Code revisions using GIT with an example work-flow,
Git Workflow for Development Teams
Start working on a new feature branch
git checkout -b 1102_gitdocuments
Note:- Feature branch name represent ticketid(1102) and short description(gitdocuments) of work
1.Do your work(CRUD) in working directory
touch gitworkflow.doc git status git add gitworkflow.doc git commit -m "Created gitworkflow.doc Basic Steps" touch gitbestpractice.doc git status git add gitbestpractice.doc git commit -m "Created gitbestpractice.doc Do's and Don't" git log
2.Make sure you are up to date with the latest from the remote development branch. Roll your local changes on top of them:
git checkout development
git pull origin development
git checkout 1102_gitdocuments
git rebase development
Note:- When Conflict Occur Fix any merge conflicts.
- Consult with the author(s) of the changes
- Consult with the Team Lead
- Use a merge tool
- When in doubt, have a merge party
- Communicate, communicate, COMMUNICATE!
3.Wrap up all of your local commits you’ve made into one commit by performing an interactive rebase:
git rebase -i development
4.When your editor opens, combine all commits into one by squashing every commit into the first:
pick ae3a3dc Created gitworkflow.doc Basic Steps squash 3c82ad8 Created gitbestpractice.doc Do's and Don't
5.Now pretty up your single commit message :
[#123456] Git Documents * Created gitworkflow * Created gitbestpractice
6.Merge your feature branch into development, push it up for your team, and delete your local branch
git checkout development git merge 1102_gitdocuments git push origin development git branch -d 1102_gitdocuments
7.Repeat for every other feature
QA
Once all features for a development are ready to be shipped out, perform the following:
1.Merge development into qa branch
git checkout qa git merge development
2.Push up your changes
git push origin qa
Production
Once all features for a qa are ready to be shipped out, perform the following:
1.Merge qa into master
git checkout master git merge qa
2.Tag the release (I version my projects using the major.minor.patch versioning)
git tag v1.0.0
3.Push up your changes
git push origin master
git push --tags