Download presentation
Presentation is loading. Please wait.
Published byIsabel Kingsmore Modified over 9 years ago
1
www.evl.uic.edu Version Control CS440 – Introduction to Software Engineering © 2014 – John Bell Based on slides prepared by Jason Leigh for CS 340 University of Illinois at Chicago
2
www.evl.uic.edu Version Control Incredibly important when working in teams. Many tools for this: Revision Control System (RCS), Subversion (SVN), CVS, GIT etc. Ref: http://en.wikipedia.org/wiki/Comparison_of_r evision_control_software http://en.wikipedia.org/wiki/Comparison_of_r evision_control_software Pro Git online book: http://progit.org/book/http://progit.org/book/ All project teams will use git from a CS server: marvin.cs.uic.edu
3
www.evl.uic.edu How Previous Version Control Systems Worked E.g. SVN, Perforce, CVS Create a central repository for holding your code. Upload initial codes to repository. Checkout codes you want to modify. Edit codes. Commit edits to the repository. Only one repository exists – shared, online.
4
www.evl.uic.edu How Git Works Git is taking the version control world by storm. Git is a distributed system. When you work on code, you CLONE remote repository. When you commit your changes you do not need to be networked to the repository server. You can push your updates later. Git has the notion of staging areas that are used to mark files that will get committed. This is really just the list of files that are monitored by git as part of a project. If you modify a file but do not stage it, it will not get committed. I.e. not all files in working directory are in git Git makes it very easy to create and switch code branches so you experiment with code ideas without damaging the main branch.
5
www.evl.uic.edu git commit git add. ( control list ) Remote repository Remote repository git init create local project OR git clone git push create local copy copy back to origin
6
www.evl.uic.edu Setup Git on Your Computer Go to: http://git-scm.com/http://git-scm.com/ Download GIT for your platform. In Terminal Window: – git config --global user.name “John Bell” – git config --global user.email jbell@uic.edujbell@uic.edu
7
www.evl.uic.edu Grab the Initial CS440 Git Repositories Right click on parent directory where you want to work Select “git bash” to open a bash shell In Terminal Window: – git clone groupName@marvin.cs.uic.edu:~/Code.git – It will ask for a password- use the one provided. – Repeat for Develop.git ( or other repositories provided. ) You should now have TWO new working directories – Code and Develop – Make sure you keep the files for each project in the correct place. NOTE: this is assuming you are using a remote repository. If instead you just want to create a git repository for yourself on your own computer, then you do: git init
8
www.evl.uic.edu Add A New File In Command Line Window: Create the file you wish to add, e.g. overloading.cpp Add your file to git’s list of contolled ( monitored ) files: – git add overloading.cpp Commit the file to the local repository: – git commit – git will ask you for a comment. Use vi style editing commands Push this file to the remote “parent” repository: – git push origin master – Origin refers to the remote repository – Master refers to the master branch of your source code
9
www.evl.uic.edu Merging When multiple people have cloned a repository, made edits and now want to push their edits, git push will fail. You will need to: git fetch to get the new changes git merge origin/master then merge the two to form a wholly new master. Then finally: git push origin master See: http://progit.org/book/ch5-2.html
10
www.evl.uic.edu Branching Lets say you want to experiment with a code idea and so you want to spin off a separate branch from the Master branch. You can use: – git branch myNewBranch create the new branch – git checkout myNewBranch switch to the branch From now on all mods to your code are occurring in the new branch. If you want to switch back to Master branch: – git checkout master Now lets say you want to merge your codes with the changes your partner has made: – git checkout master switch back to master branch – git fetch fetch the remote mods – git merge master merge with your master – git merge myNewBranch if desired merge with mods in your special branch
11
www.evl.uic.edu Git In Depth Pro Git online book: HIGHLY RECOMMENDED http://progit.org/book/ http://progit.org/book/ http://en.wikipedia.org/wiki/Comparison_of_r evision_control_software http://en.wikipedia.org/wiki/Comparison_of_r evision_control_software
12
www.evl.uic.edu Git Cheat Sheet git --help – See list of git commands. ( then git --help command ) git config – set up git init – do this if you plan to create your own local repository git clone from repository – do this to bring in a remote repository git add files – add files to staging area to mark for commit git commit – commit the file git push origin master – push the committed files to remote origin’s master branch Second person does git clone as well – makes his changes – tries to do push but fails – must do a git fetch – fetches latest updates from repository – git merge – merges the versions – git push origin master – pushes it back to the server
13
www.evl.uic.edu And one more thing… http://www.youtube.com/watch?v=dYBjVTM UQY0 http://www.youtube.com/watch?v=dYBjVTM UQY0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.