1. GIT Best Practices
1. Before starting with GIT: add yourUser Name and email tothe configurations sothatyour
changescan be tracked.
2. Commit early and often: Try to commityourcode as soonas youare done withitand tested
it locally,thiswillprotectyoufromgettingintoanytrouble of forgettingthe changesorserious
merge conflictsatlaterstage.
3. Give proper comments: Alwaysgive propercomments (be verygenerous) toyourcheck-ins.
Neveruse commentslike “Code update”or“Updatedcode”or “Code change” or “Bug Fix”
insteadgive smartcomments.AlwaysaddJIRA ticketidinthe commentif availableandgive a
brief descriptionof the change thatyou have made.Forexample like
a. “JIRA Id: XXYYZZ FixedLoginIssue with…….”
b. “Addedcode forfunctionality……..Ref:abcd.doc”
c. “Updatedfollowingsectionof code for……..Ref: …….”
Firstline of the commentshouldbe like subjectline of a formal email crisp,concise but
still elaborative.
Afterthe subjectline give ablankline thenprovide with asummaryparagraphfollowed
by the descriptionparagraphif required.
Bulletpointsare ok
4. Never do bulk commits: Neverevercommitalotof filestogetherunlesstheyare relatedtoa
single ticketorpatch.Most oftenthe ticketor the change withdeal witha most 2-3 files/scripts
committhemtogetherbutdon’tpushunrelatedfilestogether.Thisapproachwill make the
trackingeasyand incase of a rollbackitwill save alot of trouble.
5. Double check the branch towhich you are committing: Before makinganycommitdouble
checkto whichbranch youare committingyourcode.Itwouldbe bestif you alwaysworkwith
the requiredbranchforyour development.
6. Never check in your local configuration file:Alwayscreate alocal configurationfileforyour
projectand use that nevermodifyprojectlevel genericconfigurationfile forexample create a
“config-local.ini”or“log4J-local.properties”andaddthe local configurationfile tothe listof
ignore files listsothattheywon’tbe pickedupbyrepo.
7. Always pull the code before commit:There can be seriousmerge conflictsif youdonot doa
frequentpull of the latestcode fromthe repository.Rememberalwayspullthe latestcode
merge yourchangesintoit thenpushyourcommits.
8. Never develop on master branch:Alwaysuse the “Dev”or “Bug Fix”or the particularsprint
branch “Sprint_1_Dev”but neverworkonmasterdirectly.
2. DO’S
Do frequentcommits
Give proper comments
Use proper branch for commits
Always include local configuration files in ignorelist
Always pull then push not the other way round
DONT’s
Never do bulk commits
Never commit local configuration files
Never do purgeon repository
Don’ttry to be a “HERO” if you think you have screwed the
repository “ASKFOR HELP”
Never commit to master branch directly