GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.

Slides:



Advertisements
Similar presentations
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.
Advertisements

1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
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.
Version control with Github August 26th, 2014 Daniel Schreij VU Cognitive Psychology departement
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
A primer on version control at OTN
Git – versioning and managing your software L. Grewe.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Version control Using Git Version control, using Git1.
Drexel University Software Engineering Research Group Git for SE101 1.
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.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Version Control System Lisa Palathingal 03/04/2015.
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.
CS 160 and CMPE/SE 131 Software Engineering February 16 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
1 CSE 303 Lecture 19 Version control and Subversion ( svn ) slides created by Marty Stepp
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
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.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
Jun-Ru Chang Introduction GIT Jun-Ru Chang
Version Control Systems
CS5220 Advanced Topics in Web Programming Version Control with Git
4 Version control (part 1)
Source Control Systems
Version Control Systems
11 Version control (part 2)
CReSIS Git Tutorial.
SVN intro (review).
Git Practice walkthrough.
Discussion 11 Final Project / Git.
Version Control overview
Version control, using Git
CS5220 Advanced Topics in Web Programming Version Control with Git
Version Control System using Git
Development and Deployment
Software Engineering for Data Scientists
Version Control with Git and GitHub
Macaualy2 Workshop Berkeley 2017
Version Control Systems
Storing, Sending, and Tracking Files Recitation 2
Distributed Version Control with git
(Advanced) Web Application Development
Version Control with git
BIT 286: (Web) Application Programming
The Big Picture
Getting Started with Git and Bitbucket
Using Github.
Git CS Fall 2018.
Version control with Git
Introduction to Version Control with Git
Git started with git: 2018 edition
CMPE/SE 131 Software Engineering February 14 Class Meeting
Version Control with Git and GitHub
Version/revision control via git
Git Introduction.
Git GitHub.
Introduction to The Git Version Control System
Using GitHub for Papyrus Models Jessie Jewitt – OAM Technology Consulting/ ARM Inc. January 29th, 2018.
Presentation transcript:

GIT Version control

Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching (creating different versions) and Resolving differences in code updated by different programmers

Popular VCS Subversion Most open-source projects use Subversion as a repository because other larger projects, such as SourceForge, Apache, Python, Ruby and many others, use it as well. Google Code uses Subversion exclusively to distribute code. many different Subversion clients are available. Windows has Tortoise SVN Mac: Versions (a subversion client for mac) Xcode integrates a Subversion client

Popular VCS Git Initially developed by Linux kernel creator Linus Torvalds distributed version control system. There isn’t one centralized code base to pull the code from. Different branches hold different parts of the code. Used by Linux kernel, WINE, Fedora, etc. Most famous sites: github, bitbucket

Popular VCS Mercurial open-source distributed version control system, like Git. designed for larger projects, most likely outside the scope of designers and independent Web developers. extremely fast, and the creators built the software with performance as the most important feature. See comes equipped with a stand-alone Web interface Easier to use than GIT

Popular VCS Other VCS: Bazzar ( ) LibreSource ( ) Monotone ( )

Version Control with Git

Git

Git workflow

git: creating a local repository Can create a local (on your hard drive) git repository Via Xcode (option when you create a project) By hand Go to the project directory in the Terminal Create a.gitignore file (optional) Type the following commands on the command line: git init git add. git commit –m ‘Initial checkin’

remote repository a local repository is good when you’re the only developer if you’re sharing code, better to use a remote repository can create a remote repository and connect a local repository to it

Create a new remote repository at github In your user bar at the top right of any page, click the "Create a New Repo" button "Create a New Repo" button Or click on the “new repository” button: continued on next slide

github new repository Enter the name, description, public/private. Do not create a README, or a.gitignore file (though there is an option for a swift.gitignore file)

uploading local to remote In the terminal, go to the folder with your project. Create a local git repository by hand (see previous slide) In the terminal, do the following commands: git remote add origin “remote repository URL” # Sets the new remote git remote -v # Verifies the new remote URL will give you the URL of the remost repository that is associated with this git continued on next slide get this from your github site

uploading local to remote merge the remote with the local (necessary if created a README and/or a.gitignore file) git pull now push the local files to the remote git push origin master # Pushes the changes in your local repository up to the remote repository you specified as the origin

Clone the git repository on your local hard drive Once the team leader has created the repository, others can clone that repository, then push/pull changes. Go to the place where the new folder will live Get the URL from the Git-Hub project git clone This is the URL from the Git-Hub repository

Connect to a GitHub repository from your computer Another way of creating a git repository on your drive go to the folder that you’ll be using as your development folder. create a folder for this specific Repository (“Hello-World” in this example) by running the following command from your Terminal Window: mkdir Hello-World go into your new folder and run the following command from your Terminal: git init This will initialize a local Git Repository for you. Git must be installed on your computer already Now put a.gitignore file into the.git directory (see _example.txt ) _example.txt

Connect to a GitHub repository from your computer You should see a hidden folder called “.git” in your folder when you run the “ls –a” command. Next you need to link your local Git Repository to your remote GitHub Repository. To do this you will to run the following command: git remote add origin You can get the URL from your GitHub repository. pull to get the initial files git pull origin master master indicates the master branch. If you want to start with a different branch, you must indicate this.

The state of your files Git has 6 states: Ignored Untracked : Git sees the file, but it’s neither in the repository nor staged for adding to the repository. Modified : Previous contents are in the repository, but this file won’t be added until it’s staged Staged : the file has been designated for inclusion in the next commit. Unmerged : you changed the file and attempted to pull in changes from another repository, and the two sets of changes couldn’t be reconciled. Git highlights the conflicts. You must resolve. Unmodified : file’s current state is what’s in the repository.

using git at the command line checking the status: > git status making changes: change a file then check status > git status On branch master Changes not staged for commit: (use "git add..." to update what will be committed) (use "git checkout --..." to discard changes in working directory) modified: singleton.xcodeproj/project.xcworkspace/xcuserdata/barr.xcuserdatad/UserI nterfaceState.xcuserstate modified: singleton/SecondViewController.swift no changes added to commit (use "git add" and/or "git commit -a") hint about what to do

using git at the command line tell git to stage the changes: > git add SecondViewController.swift will add a particular file to be committed to the repository > git add –A # adds all new and updated or > git add. # adds all new files > git add –u # adds all updated files don’t always want to add all the changes to the repository at this time!

using git at the command line now check git status : > git status On branch master Changes to be committed: (use "git reset HEAD..." to unstage) modified: singleton.xcodeproj/project.xcworkspace/xcuserdata/barr.xcuserdatad/UserInte rfaceState.xcuserstate modified: singleton/SecondViewController.swift Changes have been staged. Means git knows about the changes but has not yet added the changes to the repository

using git at the command line Now must commit the changes to the repository: > git commit –m ‘message’ if you leave off the “-m message” you are popped into an editor of your choice (you can change this) to add a commit message. when you leave that editor, the changes are committed to the local repository but not pushed to the remote repository.

using git at the command line Now must push the changes to the remote repository: > git push all the committed changes will be pushed to the remote directory the optional is the URL of a remote repository to commit to. Not necessary if you’ve set things up correctly. the optional allows you to create a new branch To see a history of git actions use the command: > git log

using git at the command line When you start working you need to get the latest code from the repository. Do this with the pull command: > git pull all the changes from the URL will be downloaded. If is specified, changes from that branch will be downloaded.

using git at the command line If you have problems pulling or pushing, you can checkout versions and update them git checkout --ours filename.c git checkout --theirs filename.c git add filename.c git commit -m "using theirs” Now will be able to push/pull

using git at the command line Other useful commands: git merge will merge two different branches together into one git branch XXX will create a new branch with name XXX git –checkout Updates files in the working tree to match the version in the index or the specified tree. If no paths are given, git checkout will also update HEAD to set the specified branch as the current branch. See the git reference at