session git

21
Lets talk about GIT Stupid, fast, distributed content tracker Roni Saha Sr. Software Engineer Rightbrain Solution Limited & Emicrograph Business Solution

Upload: roni-saha

Post on 04-Dec-2014

417 views

Category:

Education


3 download

DESCRIPTION

Understanding, Using the Git source control system with some case studies.

TRANSCRIPT

  • 1. Lets talk about GITStupid, fast, distributed content tracker Roni SahaSr. Software EngineerRightbrain Solution Limited & Emicrograph Business Solution

2. Git uses a distributed model Centralized ModelDistributed Model(CVS, Subversion, Perforce)(Git, Mercurial)Result: Many operations are local 3. Git local file lifecycleuntracked unmodifiedmodified stagededit the fileadd the filestage the fileremove the file commit 4. Overview of Git Workflow/Commands 5. Git commands command descriptiongit clone url [dir]copy a git repository so you can add to itgit add filesadds file contents to the staging areagit commit records a snapshot of the staging areagit status view the status of your files in the working directory and staging areagit diff shows diff of what is staged and what is modified but un-stagedgit pull fetch from a remote repo and try to merge into the current branchgit push push your new branches and data to a remote repositoryothers: init, reset, branch, checkout, merge, log, tag 6. Typical Development WorkflowGet the code git clone some-repogit pullModify Code Cerate Delete/Edit Save the changes git addgit commit -m "message" Sync with remote git pull git push 7. Branch VS TagBranch Tags A branch is just a line of Milestone in the life ofdevelopmentproject Branch head mean a Read Only, i.e. referencereference to the mostto a fixed commit idrecent commit on a branch 8. Merge, The Blessing!!Some merge StrategiesResolve This can only resolve two headsRecursive Default strategy when pulling or merging one branchOctopus More than two branchesOurs/Theirs Just mark as mergedNo-commit Do not create a new commit automatically 9. Conflict, The Devil!! 10. Resolve Conflict Resolve Decide not toactions!merge $ git merge --abort Resolve the Edit the files intoconflictsshape then commit Conflict 11. Client is always right!!Git allows you to use git locally and use SVN as a remote repository Create Git clone of Subversion repo $ git svn clone -s svn://example.com/repo Update from SVN $ git svn rebase Commit to SVN $ git svn dcommit 12. Case Studies 13. Merge Commands Merge branches fixes and enhancement to the current branch, making an octopus merge: $ git merge fixes enhancements Merge branch obsolete into the current branch, using ours merge strategy: $ git merge -s ours obsolete Merge branch partial into the current branch, but do not make a new commit automatically: $ git merge --no-commit partial Cancel a merge: $ git merge --abort 14. Cancel/Fix a commit From latest to some point $ git reset .. Edit . $ git add .... $ git commit -c ORIG_HEAD Some commit in the past $ git revert Fix latest commit $ git commit --amend 15. Partial commit You made several unrelated changes to the same file $ git add -p 16. Pulling into a dirty tree git stash save, git pull, git stash pop 17. Suspend work for a fix git stash save, do the fix, commit, git stash pop 18. Moving work to a branch 19. Moving work to a branchSwitch to (Create) the v1.12"branch git checkout v1.12[git merge master] Or git checkout -b v1.12Forcibly move master back toearly stage git branch -f master HEAD^^^ 20. Any More Case Studies/Question? 21. Thank You