Drexel University Software Engineering Research Group Git for SE101 1.

Slides:



Advertisements
Similar presentations
Introduction To GIT Rob Di Marco Philly Linux Users Group July 14, 2008.
Advertisements

Intro to Version Control Have you ever …? Had an application crash and lose ALL of your work Made changes to a file for the worse and wished you could.
Version Control System (Sub)Version Control (SVN).
Git Branching What is a branch?. Review: Distributed - Snapshots Files are stored by SHA-1 hash rather than filename Stored in git database in compressed.
Git/Unix Lab March Version Control ●Keep track of changes to a project ●Serves as a backup ●Revert to previous version ●Work on the same files concurrently.
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
1 Web Design Workshop DIG 4104c Spring 2014 Dr. J. Michael Moshell University of Central Florida Lecture 2: The git source control system
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Getting Started with GIT. Basic Navigation cd means change directory cd.. moves you up a level cd dir_name moves you to the folder named dir_name A dot.
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
With Mercurial and Progress.   Introduction  What is version control ?  Why use version control ?  Centralised vs. Distributed  Why Mercurial ?
Peter Ogden and Josh Levine.  Motivation  High level overview  Walk through the common operations  How not to break things (too badly)
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Drexel University Software Engineering Research Group 1 Eclipse for SE101.
Version control Using Git Version control, using Git1.
Introduction to Git and Discussion on assignment 1 Gang Luo Sept. 14, 2010.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Git Fundamentals Rochelle Terman 13 January 2014.
1 GIT NOUN \’GIT\ A DISTRIBUTED REVISION CONTROL AND SOURCE CODE MANAGEMENT (SCM) SYSTEM WITH AN EMPHASIS ON SPEED. INITIALLY DESIGNED AND DEVELOPED BY.
Prepared by: Steve Teo Contributors: Tong Huu Khiem.
When collaborating, it is important to manage changes in the models. For example: –To create or edit a submodel E.g. Habitat suitability is replaced with.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
© 2015 by Herb Holyst Introduction to git Cytomics Workshop December, 2015.
TEAM FOUNDATION VERSION CONTROL AN OVERVIEW AND WALKTHROUGH By: Michael Mallar.
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Carl’s Ultra-Basic Guide to the Command Line and Git Carl G. Stahmer Director of Digital Scholarship cstahmer UD Davis Data Science.
Installing git In Linux: sudo apt-get install git In Windows: download it from run the setuphttp://git-scm.com/download/win.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
Version Control Systems
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Information Systems and Network Engineering Laboratory II
Source Control Systems
Discussion #11 11/21/16.
11 Version control (part 2)
CReSIS Git Tutorial.
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
SSE2034: System Software Experiment 3 Spring 2016
Version Control overview
Software Engineering for Data Scientists
Version Control Systems
An introduction to version control systems with Git
An introduction to version control systems with Git
LECTURE 3: Software Configuration Management
The Big Picture
An introduction to version control systems with Git
Getting Started with Git and Bitbucket
Git CS Fall 2018.
Git started with git: 2018 edition
Version Control with Git and GitHub
Git Introduction.
Git GitHub.
Advanced Git for Beginners
Presentation transcript:

Drexel University Software Engineering Research Group Git for SE101 1

Drexel University Software Engineering Research Group 2 Overview What is Git? Creating a bare Git repository Creating a working copy of the repository Committing files to your repository Working remotely Reverting Submitting your work for se101

Drexel University Software Engineering Research Group What is Git? Git is a distributed version control system enabling you to: Easily track the changes you make to your code Easily collaborate with others when you write code Useful links: Git: Wikibooks: 3

Drexel University Software Engineering Research Group Creating a Git repository Create and change to the directory where we will put our repository $ cd $ mkdir –p ~/se101/git/se101.git $ cd ~/se101/git/se101.git Next, create the bare repository. A bare repository is a central repository that you will not access directly: $ git init --bare A bare Git repository will now be created at /home/userid/se101/git/se101.git. Try typing ls to see what was created. $ ls 4

Drexel University Software Engineering Research Group Cloning a working copy 5 Change back to your ~/se101/git folder: $ cd ~/se101/git/ Next, we want to create a working copy of our empty repository: $ git clone se101.git workspace This creates a folder workspace where we will put all of our labs and projects. Change into the new folder: $ cd workspace Create a new folder for the first problem in assignment 1 (Problem 2.17): $ mkdir A1_2_17 $ cd A1_2_17

Drexel University Software Engineering Research Group Adding a file 6 Create a file $ touch numbers.java Check the git status. It shows untracked changes. $ git status Now we need to add the file to the repository: $ git add numbers.java Check the git status. It shows our changes staged to be committed: $ git status

Drexel University Software Engineering Research Group 7 Git statuses Files in the git directory can be in one of four states in relation to Git Untracked: The file has not been added to the repository New: The file has been added to the staging area of the repository, but has not yet been committed to the repository Unmodified: The current version of the file has been committed to the repository Modified: The file has been committed to the repository, but has been modified since it was last committed

Drexel University Software Engineering Research Group Committing 8 Commit the file to your cloned copy. “Initial commit” is a comment to help you identify this version. The comments are mandatory and if you don’t specify one, git will open a text editor for you, where you will be required to write one: $ git commit –m "Initial commit" We want to push our changes back to the bare repository so we can check them out elsewhere $ git push origin master

Drexel University Software Engineering Research Group Committing changes 9 Edit the file you just committed. Try: $ echo "//testing" >> numbers.java $ git status We need to add the file again to commit our changes! $ git add numbers.java Check the status! You should see “modified”: $ git status Commit the file to your cloned copy and push it to the master! $ git commit –m "added test comment" $ git push

Drexel University Software Engineering Research Group Git workflow Every time you create a new file or change and existing file you have to use four commands: git pull: make sure your working copy is up to date before doing work to avoid conflicts git add : to add the files you created / changed git commit –m "message" : to commit the changes to your cloned repository git push : to push the changes to the master Always remember to check the status to make sure your changes are committed 10

Drexel University Software Engineering Research Group Viewing commit history 11 Check the history for the current project $ git log It will show your revision history with hashes to identify each commit, the author, date, and the messages you type.

Drexel University Software Engineering Research Group Working off campus (Ubuntu) 12 Install Git if you don’t have it yet: $ sudo apt-get install git Change to the directory you want to clone to $ cd whatever_path_you_want Remember, this is your computer, so you can put this wherever you want. Somewhere in your home folder would make sense, like ~/se101/ Clone the master: $ clone workspace ** Always remember to “git pull” to avoid conflicts **

Drexel University Software Engineering Research Group Working off campus (Windows) 13 Install Git if you don’t have it yet: Make sure you choose: checkout as-is and commit unix-style during install. Now run Git Bash from your start menu and you have a bash shell you can work in. By default, you will be in your /c/User/Username folder. Changing to your My Documents folder would be prudent: $ cd Documents Now, you can follow the Unix instructions (skipping the installation step)

Drexel University Software Engineering Research Group Working off campus (OSX) 14 Install Git if you don’t have it yet: Start a new terminal window (Apple-Space and then type Terminal) You will be in your /users/userid folder on your computer. It would make sense to change to your documents folder $ cd Documents Now, you can follow the Unix instructions (skipping the installation step)

Drexel University Software Engineering Research Group Git repository hierarchy Bare repository ~/se101/git/se101.git on tux Working copy (local) ~/se101/git/workspace on Tux Working copy (remote) In whatever folder you choose On your laptop or computer at home 15 ***Remember to use push and pull commands to keep working copies synchronized***

Drexel University Software Engineering Research Group Advanced Git Techniques Reverting committed changes If you committed something by accident and you want to undo your changes Reverting uncommitted changes If you changed something that you haven’t committed but want the latest version in the repository back. 16

Drexel University Software Engineering Research Group Reverting a commit 17 Suppose we have made a mistake and we want to revert our last commit. The latest commit is the HEAD commit. We can revert it using $ git revert -n HEAD If we want to revert a specific revision, we try: $ git revert –n [REVISION_ID] Where [REVISION_ID] is the first few characters from the unique identifier listed in the log (for example 0071e80 was my latest commit) The –n switch tells git not to immediately commit it.

Drexel University Software Engineering Research Group Reverting uncommitted changes 18 Suppose we have made a mistake, but we haven’t committed it yet. We can undo local changes all the changes we have made since our last commit using two different commands: Revert all uncommitted changes: $ git reset --hard HEAD Revert a specific file: $ git checkout test_file

Drexel University Software Engineering Research Group Using Eclipse Set your Eclipse workspace to the path of your cloned working copy of the repository: /home/userid/se101/git/workspace Go to File->Switch workspace if not prompted. 19

Drexel University Software Engineering Research Group Using Eclipse Create a new Java Project for each exercise: For assignment 1, call your projects: A1_2_17 for Exercise 2.17 from assignment 1, A1_2_20 for Exercise 2.30 from assignment 1, And so on for all remaining assignments. For lab 2, call your projects: L2_1 for the first exercise from lab 1, L2_2 for the second exercise from lab 2, And so on for all remaining labs. *** If you do not name your labs and assignments correctly, we will not grade them! *** 20

Drexel University Software Engineering Research Group Starting the first assignment 21 A folder will be created for each of the projects you create in Eclipse. You will have five different folders/projects: A1_2_17, A1_2_30, A1_2_31, A1_2_32, A1_2_35 Each folder will contain a bin folder with your.class files in it and a src folder with your.java files in it Always add and commit your.java files $ git add *.java

Drexel University Software Engineering Research Group UML Diagrams 22 Some assignments require UML diagrams. You can create UML diagrams in any program of your choosing (ArgoUML, Visio, ObjectAid, etc.) UML diagrams should be put in the doc subfolder for the corresponding exercise. For example, the UML diagram for assignment 1, problem 2.17 would go in A1_2_17/doc/ Always submit a.png image of your UML diagram Always add and commit your UML files $ git add doc/*