Download presentation
Presentation is loading. Please wait.
1
Source Code Management
For CSE 3902 By: Matt Boggus
2
Overview Motivation and benefits of source code control
Concepts underlying source code control implementations Options integrated into Visual Studio and usage tips
3
Basic premises of team project work
Save previous versions of project (files) Source code Build instructions (.sln, .vsproj) Data / Art files Documentation Not Visual Studio user settings Provide a unique label or index for each previous version and be capable of getting each previous version on demand Track who made each edit Allow multiple users to view and modify the project simultaneously
4
Usually sub-optimal option
Keep all project files on a one computer, allow multiple users to view the files Image from
5
Usually sub-optimal option
Keep all project files on a USB drive, physically pass it around as needed Image from
6
Usually sub-optimal option
Everyone keeps their own copy of the project, and each time anyone changes a file they might: the new files to everyone Save the new files on a shared network drive (ex: BuckeyeBox) Image from
7
Ultimately a process design decision
Might be made by: Team Team leaders Boss(es) Consider the team and file formats when choosing how to manage project assets Might use version control for source code and shared drive for images and art assets Petabytes of data might be transferred faster using hard drives and the US postal service than over the internet Source code management does not eliminate the need to communicate with your teammates
8
File consistency Local copy Webserver copy
9
Practice question How would you implement a program that takes a string input then allows the user to change the string, but also revert it back to any of its previous states?
10
Storing results vs. storing file differences
Figures for next few slides are from
11
You local working copy is separate from versions stored elsewhere
12
Conflicts
13
Branching
14
Merging
15
Commit structure for one repository
Figures from next few slides from
16
Entire commit history is a directed, acyclic graph (DAG)
17
Centralized vs. Decentralized
Two options integrated within Visual Studio Team Foundation Version Control (subversion or SVN based) Centralized ; one repository GIT Distributed ; every machine is a repository Image from
18
Central Server Remote Server
Clipart figure from files.channel9.msdn.com/thumbnail/d8ad47a e6d-9b8a-2d0843fa718c.pptx
19
Setup for source control in Visual Studio
Team->Connect to… In Team Explorer, Select Team Projects… Click Servers… button, then Add… Copy-paste URL from the project creator, then click ok Should look something like this: Select server to connect, signing in with the same account you set up for Visual Studio Online task planning
20
Working with TFVC In Visual Studio, connect to your team’s project
First time setup Set local directory where you will store your copy of the project Map & Get Day-to-day use Under Team Explorer, click Source Control Explorer Right click on root folder->Get latest version After adding code and successfully rebuilding the solution, check in the changes
21
Working with GIT In Visual Studio, connect to your team’s project
First time setup Clone repository on your local machine Day-to-day use Under Team Explorer, click Source Control Explorer Fetch commits Pull commits After adding code and successfully rebuilding the solution, push your commit The GUI options in Visual Studio for GIT are significantly less powerful than the command line options
22
Important practice After resolving a merge or conflict, get the latest version / fetch and pull the master branch, then make sure it still compiles and runs If you broke the build it is your responsibility to fix it
23
Source control and visual studio project files: An example of a common problem
MarioCoder’s .proj file BlockCoder’s .proj file <Project xmlns=" per/msbuild/2003"> <ItemGroup> <Compile Include="helloworld.cs" /> </ItemGroup> <Target Name="Build"> <Csc </Target> </Project> <Project xmlns=" per/msbuild/2003"> <ItemGroup> <Compile Include="helloworld.cs" /> </ItemGroup> <Target Name="Build"> <Csc </Target> </Project>
24
How to avoid this problem
Only allow 1 person to add new files to project / commit changes to project file Update before committing The shorter the time between getting code updates and committing new code, the less likely you will break the build Some version control supports locking files
25
References and additional learning resources
Microsoft documentation on Git and VSTS us/vsts/git/overview?view=vsts#tfvc_or_git_summary 3901’s GIT lecture state.edu/~giles.25/3901/lectures/lecture02.pdf control/ files.channel9.msdn.com/thumbnail/d8ad47a e6d-9b8a- 2d0843fa718c.pptx mentions several other useful tools within VSTS, though the screenshots and content refer to the old name, Team Foundation Services (TFS)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.