Thursday, 29 March 2018


Git is Distributed version Control system

Standard Git  Practices
1)master Branch
3)Different Environments DEV ,IT ,UAT ,Prod. 
4) Jenkins for Continuous Integration and Deployment . 

Here is stand practice for Git

2)we can Fork the masterBranch then we get the ForkedMasterBranch .it will create a copy of master Branch
3)on that ForkedMasterBranch for each enhancement we will create a feature Branch by each developer .we will commit the changes to the feature Branch and do the pull request  to commit the changes to forkedMasterBranch .

Pullrequest means the latest code in the ForkedMaster Branch we will get and merge the feature Branch after Peer review .Means once the developer commit his changes on his feature Branch .we will raise the pull request and assign to the reviewers .then that guy will get the mail that some one made pull request .so that guy will open it and merge the code by resolving the conflicts if any .

Now the code is @ForkedMasterBranch .From this we can test the code in DEV,IT,UAT using Jenkins .

For Prod Environment we need to deploy  the code from master Branch through Jenkins .so we have to commit the code From "ForkedMasterBranch " to "master Branch" by doing pull request as earlier .Here only few will have the permissions to  commit the code into master Branch  like Leads .so Lead will we the responsible person to commit the code into master Branch .

Check out the Project from Git

Eclipse>>Project Explorer>>Import>>Import>>Projects from Git>>Clone URI>>Give the URI username/password
select the Branch you what to check out>>select the Work Space you what check out
Select the Radio Button "Import existing Eclipse Projects"
Click on Finish
To see which line Committed in git by whom in Eclipse
Select/Open a file>>Right click>> Team>>show Revision information

How to Commit the Files into Git from Eclipse

1)Get the Backup of the Files
2)Right click on the Project >>Team >>Pull>> give Username and Password
a)  if no conflicts, git will put all the Files from Repository to your workspace. Now we can commit your all out going changes into the git .
b) if you got any Conflicts,take the conflicted files back up
 we have to delete the Conflict files and then Pull again
you will now have the remote branch latest files and your local non conflit files in your work space.
Now we can merge you changes manually into that Project
3)Before Committing you changes pull again. Because while you are merging someone may commit so this may leads to conflicts again
so, better to pull after you merge your changes
4)Now Drag and Drop you changes to Index/staging and give the Commit Comment. now you have 2 options
push and "push and Commit"
push and Commit: if you click on this button then your changes will be committed in that particular remote Branch
push: if click on the push, then you changes will be There in the staging not in the remote Branch.
so, you can go to the Browser and do the pull request and assign a reviewer of your code.
Then the changes will be verified by that reviewer. if he gives and comments you can fix that and then
the reviewer will merge you changes into remote Branch

 Note : if you did "push and Commit" .But your commits are not reflecting  then do the Project>>Right click Team>>push to upstream option if you selected then your commit changes will be able to see on the Git

No comments:

Post a Comment