Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
A Distributed Version ControllingSystemBUET Systems Analysis, Design & Development GroupMd. Maksud Alam ChowdhuryCSE ,BUET...
 A version controlling system Distributed Most popular software for managingcodebases Support for remote collaboration
 Remove millions of backup folder Smartly merge separate codes Track day to day changes of codes Small changes won’t d...
 Branching & Merging (to be discussed widely) Small & Fast Distributed Free & Open Source
 Standalone version:http://git-scm.com/downloads Portable version:https://code.google.com/p/msysgit/downloads/list They...
 Navigate to your project folder Right Click on Folder-> Git Bash It will open a shell
 Type git init to initialize a git repo on yourproject folder. Having existing codes won’t cause problem In most cases ...
 Let’s add some files(not needed in case already have existing codes) Let’s create “a.cpp” , “b.txt” , “c.cpp” in the“De...
 So we think our app is stable right now. So we need to commit the files to bepreserved Type git add . Typegit commit ...
 We can check the status of the currentcondition of codes by typinggit status Every commit is saved uniquely with anumbe...
 By Default we are in the master branch which isroot . Branches are independent of each other Enough talking !!!!!! Le...
 Typegit checkout –b dev It will create a new branch dev and switch to“dev“ branch The new branch will contain exact co...
 Let’s change the content of “b.txt” and create“d.txt” So we have changed “b.txt” and added “d.txt” Now Typegit status
 We now commit the current working directory So Type Againgit add .git commit –am “commit message”
 Let’s switch back to the “master” branch Typegit checkout master It will restore the master branch codes Note that “b...
On Master Branch On dev branch
 So we were in the master branch again We are sure to merge the dev branch intomaster branch Typegit merge dev
 Surprisingly there is no conflict in “b.txt” Because until now you are the only personwho changed the branch in local w...
 We need a central place to synchronize theteam members repositories Github , Bitbucket , gitorious , Assembla ,reposito...
 Similarly as previous slide Typegit push origin dev
 There are several mechanisms [try googling] We will show an easy approach for smallteams We will maintain master for u...
 After finalizing some features team memberswill create a temporary branch The temporary branch will be incrementallymer...
 Do ignore such files while committing Create a .gitignore file and list the directoriesor file not to be tracked Keep ...
 Conflicts arise when You have changed your localfiles and committed them in your branch But someone else have also chan...
 We change our local file b.txt again in master Add , Commit it We pull some previous version of the same file indevgit...
 Here head is local version Lower part is the fetched version The marker is where things actually started to bedifferen...
 Git tool command Manually change the conflicting files Add, Commit , Push Don’t Pull directly At first fetch (git fe...
 If you already have a repo on bitbucket orgithub like the one we created Just typegit clone <http_link_of_project> So ...
 git init git add . git commit –am “<your commit message>” git status git checkout –b <New_Branch_Name> git checkout...
 http://git-scm.com/ http://gitref.org https://bitbucket.org
Please Email Any Question At:mc65799@gmail.com
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
BSADD-Git-TRAINING
Upcoming SlideShare
Loading in …5
×

BSADD-Git-TRAINING

358 views

Published on

G

Published in: Technology
  • Be the first to comment

  • Be the first to like this

BSADD-Git-TRAINING

  1. 1. A Distributed Version ControllingSystemBUET Systems Analysis, Design & Development GroupMd. Maksud Alam ChowdhuryCSE ,BUETmc65799@gmail.com
  2. 2.  A version controlling system Distributed Most popular software for managingcodebases Support for remote collaboration
  3. 3.  Remove millions of backup folder Smartly merge separate codes Track day to day changes of codes Small changes won’t destroy wholeproject Disk crash or virus won’t hamper yourcodes ever !!!!!!!!!!!!!
  4. 4.  Branching & Merging (to be discussed widely) Small & Fast Distributed Free & Open Source
  5. 5.  Standalone version:http://git-scm.com/downloads Portable version:https://code.google.com/p/msysgit/downloads/list They both have command line interface .
  6. 6.  Navigate to your project folder Right Click on Folder-> Git Bash It will open a shell
  7. 7.  Type git init to initialize a git repo on yourproject folder. Having existing codes won’t cause problem In most cases , you will create a repo where youhave your codes. Note that we are in master branch by default We will discuss it later on branching.
  8. 8.  Let’s add some files(not needed in case already have existing codes) Let’s create “a.cpp” , “b.txt” , “c.cpp” in the“DemoApp” Folder. Add some dummy texts on them Current Working DirectoryDemoApp/|--a.cpp|--b.txt|--c.cpp
  9. 9.  So we think our app is stable right now. So we need to commit the files to bepreserved Type git add . Typegit commit –am “message describing commit” So git will have save current codes as the lateststable code on master branch
  10. 10.  We can check the status of the currentcondition of codes by typinggit status Every commit is saved uniquely with anumber You can switch back to any previous commitany time
  11. 11.  By Default we are in the master branch which isroot . Branches are independent of each other Enough talking !!!!!! Let’s create another branch “dev” which is adevelopment version. We will experiment in the dev branch where asfully stable codes will be in master branch
  12. 12.  Typegit checkout –b dev It will create a new branch dev and switch to“dev“ branch The new branch will contain exact copy fromwhere we created it. Any change we do now in the workingdirectory , after commit will go for “dev”branch
  13. 13.  Let’s change the content of “b.txt” and create“d.txt” So we have changed “b.txt” and added “d.txt” Now Typegit status
  14. 14.  We now commit the current working directory So Type Againgit add .git commit –am “commit message”
  15. 15.  Let’s switch back to the “master” branch Typegit checkout master It will restore the master branch codes Note that “b.txt” is restored & d.txt is gone So you have two separate version of codes
  16. 16. On Master Branch On dev branch
  17. 17.  So we were in the master branch again We are sure to merge the dev branch intomaster branch Typegit merge dev
  18. 18.  Surprisingly there is no conflict in “b.txt” Because until now you are the only personwho changed the branch in local workstation
  19. 19.  We need a central place to synchronize theteam members repositories Github , Bitbucket , gitorious , Assembla ,repositoryhosting etc. Github only provides public repo If you don’t want it to be public go forBitbuckethttps://bitbucket.org/account/signup/
  20. 20.  Similarly as previous slide Typegit push origin dev
  21. 21.  There are several mechanisms [try googling] We will show an easy approach for smallteams We will maintain master for ultimate stableversion . Each team member will have their own branch
  22. 22.  After finalizing some features team memberswill create a temporary branch The temporary branch will be incrementallymerged and tested by team captain But there might be conflict in configurationfiles which might hamper project.[Android menifest.xml , database settingsetc ]
  23. 23.  Do ignore such files while committing Create a .gitignore file and list the directoriesor file not to be tracked Keep a list of changelog.txt file After merging master do manually change theconfigurations
  24. 24.  Conflicts arise when You have changed your localfiles and committed them in your branch But someone else have also changed the samefiles in his own branch You want to merge his branch Git will have no way to decide which one to keepand which one to abandon So it keeps both of them in a way you canidentify difference.
  25. 25.  We change our local file b.txt again in master Add , Commit it We pull some previous version of the same file indevgit pull origin dev Pull = fetch + merge Now this will create a conflict
  26. 26.  Here head is local version Lower part is the fetched version The marker is where things actually started to bedifferent It would not create a conflict if appending wasrequired or creating a new or deleting a file wasrequired But here a complete rewrite is required
  27. 27.  Git tool command Manually change the conflicting files Add, Commit , Push Don’t Pull directly At first fetch (git fetch origin dev) See Whether any difference (git diff origin/dev) The decide to merge
  28. 28.  If you already have a repo on bitbucket orgithub like the one we created Just typegit clone <http_link_of_project> So you don’t need to bother about backup ordisk lost
  29. 29.  git init git add . git commit –am “<your commit message>” git status git checkout –b <New_Branch_Name> git checkout <Branch_Name> git merge <Branch_Name> git remote add <Name_For_Server> <Link_Of_Your_Project> git push <Name_For_Server> <Branch_To_Push> git pull <Name_For_Server> <Branch_To_Pull> git fetch <Name_For_Server> <Branch_To_Fetch> git diff <Branch_To_Compare_With_Current_Branch>
  30. 30.  http://git-scm.com/ http://gitref.org https://bitbucket.org
  31. 31. Please Email Any Question At:mc65799@gmail.com

×