1 / 35

Version Control

Version Control. TFS Without Fear. Getting To Know You. Who here uses version control? What tools do you use? Why do you use it?. Why Talk About Version Control. Most colleges don’t teach it Is an integral part of a programmers daily life Should be using it multiple times per hour

orde
Download Presentation

Version Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Version Control TFS Without Fear

  2. Getting To Know You • Who here uses version control? • What tools do you use? • Why do you use it?

  3. Why Talk About Version Control • Most colleges don’t teach it • Is an integral part of a programmers daily life • Should be using it multiple times per hour • Many people do not take full advantage • Many people use it wrong

  4. What it is and does • A repository containing a project’s history • Tracks project artifacts’ history • What does that mean? • It keeps a record of each change to a project’s artifacts • The first step to CI

  5. What it isn’t • Backup system

  6. Why We Use It • Track changes throughout product life • task completion • bug fixes • Story/feature completion • Allows Teamwork • multiple people collaborate on project • Can recover from faulty commits • rollback

  7. Why Track History? • Frequently need to know • When was feature added? • When was bug fixed? • When did we release?

  8. Why would we need to know that? • Where are we in development? • Release notes • What was included in release? • When was bug introduced? • Hot-Fixes

  9. How we use it • We commit (check in) code that is “done”, along with the associated tests • Tests all pass (not just the new ones) • Code is refactored

  10. What we store • Whatever we need to successfully build the system • Source code • Test code • Build files • Project definitions • Configuration files

  11. What we do not store • Anything the build process can create • NuGet packages • Compiler generated artifacts • dlls • exes • Etc.

  12. How version control works • Various implementations • Distributed • E.g., GIT, Mercurial • Out of scope for this presentation • Centralized • E.g., CVS, Svn, TFS • Server based workspace • Local workspace

  13. Centralized Repository • Repository on some server holds history • Server based workspace • The server tracks all changes you make • Requires connection to server while working • Local workspace • Your local workspace tracks all changes you make • No connection necessary until commit • We discuss centralized local workspace

  14. TFS Local Workspace • Maps repository location local folder • Adds hidden folder to local machine • $tf • Tracks changes in $tf • Commit moves changes to repository

  15. When to Commit • When TASK is done • When BUG is fixed • Do not wait until Story is done

  16. Do NOT End Day Without Commit • Why Not??? • If can’t finish in a day, task too big • You probably don’t fully understand problem • Your code will be too complex • Other problems exist

  17. Example • Jane works on big task • Doesn’t finish, goes home • Code is on her work station • Does not work next day • Got sick, hit by bus, … • Team is stuck waiting on task

  18. Solution • Delete all of your code • Start over tomorrow • Break task into effort < 1 day • Complete manageable tasks • Commit completed task before leaving • Some would assign task to different person

  19. Commit – What it Means • Your code is done • For the current task • Your code is tested • You put your seal of guarantee on the code • Now you check in to repository • Code is available to team

  20. Commitment to Your Team • You make a promise to your team that your code is tested and works to specification

  21. Interesting Observation • You should be able to deploy a working subset of the system from any commit

  22. How to Commit • Select files to commit • Usually 2: test, production • If more, probably have poorly defined tasks • Link to task • Write good comment

  23. Write Good Commit Comment • A. K. A. – Log message • To help a programmer in the FUTURE • Task description does part • Depends on GOOD task description • What you did • Why you did it

  24. Workflow – The College Way • Write some code • Run the code to see if it works • Fix as necessary • Repeat until assignment is done

  25. Workflow – Single Professional Programmer • Refresh from repository • Write test code • Edit production code • Run tests • Loop to 3 until all tests pass • Loop to 2 until task is complete • Commit to repository Some might swap 6 & 7

  26. Things to Notice – Working Alone • Refresh from repository • Your local workspace matches the latest in repository exactly • You do your work as described above • You commit • your local workspace matches the latest in repository exactly • Life is Good

  27. Workflow – Multiple Professional Programmers • Refresh from repository • Write test code • Edit production code • Run tests • Loop to 3 until tests pass • Loop to 2 until task is complete Now what? Ready to commit?

  28. Things to Notice – Working on Team • Refresh from repository • Your local workspace matches the latest in repository exactly • You work as though you are alone • You commit • Your local workspace might not match repository • Code in repository might not even compile • What the ???

  29. You Need Extra Steps • Other programmers make changes • Possibly including your current file • Facilitates team projects

  30. Workflow – Multiple Professional Programmers - Continued • refresh from repository • merge as necessary • run tests • edit production code to pass tests • run tests • loop to 10 until all tests pass • loop to 7 until all tests pass • commit to repository

  31. 1st Step to CI? • What is CI? • Continuous Integration • On Commit • Build server builds code • Runs unit tests • Reports results • If your code breaks the build, but is in VC your team is dead in the water

  32. TFS Solution • Gated Build • Shelves changes • Builds shelveset • IFF build passes – commits • Else – reports error

  33. Demo • CI Build • CI Build w/ error • Gated Build • Gated Build w/ error

  34. Try It • MSDN subscription • Visual Studio Online - free • http://www.visualstudio.com/products/visual-studio-online-overview-vs

  35. Learn More • http://msdn.microsoft.com/en-us/library/vstudio/ms181237.aspx • Contact • CAndersen@planetds.com • Blog: http://geekswithblogs.net/ChuckAndersen

More Related