(Advanced) Web Application Development

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
Introduction to Git and Github Joshua imtraum.com.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Programming in Teams And how to manage your code.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Git – versioning and managing your software L. Grewe.
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
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.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
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.
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.
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.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Version Control Systems
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Introduction to GitHub
M.Sc. Juan Carlos Olivares Rojas
Information Systems and Network Engineering Laboratory II
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
Git and GitHub primer.
11 Version control (part 2)
CReSIS Git Tutorial.
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
Version Control overview
Version control, using Git
CS5220 Advanced Topics in Web Programming Version Control with Git
Development and Deployment
Version Control with Git and GitHub
Macaualy2 Workshop Berkeley 2017
Version Control Systems
Storing, Sending, and Tracking Files Recitation 2
An introduction to version control systems with Git
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
An introduction to version control systems with Git
BIT 286: (Web) Application Programming
The Big Picture
An introduction to version control systems with Git
Getting Started with Git and Bitbucket
Part 1: Editing and Publishing Files
Version control with Git Part II
Git CS Fall 2018.
Version Control System - Git
Version control with Git
Introduction to Version Control with Git
Introduction to Git and GitHub
Git started with git: 2018 edition
CMPE/SE 131 Software Engineering February 14 Class Meeting
Version Control with Git
Version Control with Git and GitHub
GitHub 101 Using Github and Git for Source Control
Version Control with Git
Git GitHub.
Introduction to The Git Version Control System
Presentation transcript:

(Advanced) Web Application Development More Git for Version Source Control Diagrams from http://git-scm.com/book Bruce Scharlau, University of Aberdeen, 2017

Bruce Scharlau, University of Aberdeen, 2017 Discuss with the person next to you why we want you to use Git for your work Bruce Scharlau, University of Aberdeen, 2017

Git provides a means for both: a global ‘what if’ as well as a global ‘undo’ in our projects Bruce Scharlau, University of Aberdeen, 2017

Where we’re going today Look at why we need version source control Look at how Git works for better understanding Try some ideas for better insight to Git Bruce Scharlau, University of Aberdeen, 2017

Bruce Scharlau, University of Aberdeen, 2017 Version control provides an undo for us so we can make changes with a safety net http://www.flickr.com/photos/daniandgeorge/8682531564/in/photolist-eeff95-8RRLk5-5UezrB-azM8yB-2L86u/ Bruce Scharlau, University of Aberdeen, 2017

There are many types of version control Some were local, others were server based, and some were distributed Git is a distributed version control system Git is used for growing number of projects including: linux, ruby and rails and many gems Bruce Scharlau, University of Aberdeen, 2017

Git tracks file changes Git is a version control system which tracks changes in files inside its repository As long as you’ve put the file into the repository tracking system, Git will know what’s been changed Bruce Scharlau, University of Aberdeen, 2017

Use one Git repository per project Create a new project in its own folder and then create a repository in the project git init git add . git commit –m ‘initial commit’ Bruce Scharlau, University of Aberdeen, 2017

Git tracks changes in files Git watches files and tracks the differences between different versions of files and stores those differences – hence it’s very lightweight and fast It only keeps the differences between versions Bruce Scharlau, University of Aberdeen, 2017

Git provides snapshots others Other systems track changes in files, eg subversion, CVS, etc Git Git stores data as snapshots, so a clone is the full backup of project Bruce Scharlau, University of Aberdeen, 2017

Git has three areas of operation Modified is changed, uncommitted file Committed means data is in repository Staged is modified file marked to go into commit snapshot Bruce Scharlau, University of Aberdeen, 2017

Four file status options Staged is what will be added to next commit Untracked is ignored Modified is changed, but not added to stage for commit Unmodified is unchanged Bruce Scharlau, University of Aberdeen, 2017

You can drop items from staging https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things Remove from ‘staged’ with ‘reset’ and ‘checkout’ to discard changes NOTE: discarded changes are ‘lost’ and unrecoverable Bruce Scharlau, University of Aberdeen, 2017

Rolling back commit changes Use ‘reset’ to undo commits https://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified has the details Hard and Soft resets move you back in commits Bruce Scharlau, University of Aberdeen, 2017

Tags let you refer to versions Git tag is a simple way to refer to previous commits Git tag is better than remembering/using the hash value of a commit Use ‘git tag <name>’ to create a tag And ‘git tag’ to list tags Bruce Scharlau, University of Aberdeen, 2017

Bruce Scharlau, University of Aberdeen, 2017 Demo the Git basics Show git tag, untracked, tracked, tracked and modified, and staged, plus committed and how to work with these Git immersion from labs 13->19 http://gitimmersion.com/lab_13.html GIT DEMO Show tagging versions,thenuntracked, tracked, tracked and modified, and staged, plus committed and how to work with these git tag <name>git checkout v1^ to get previous version checkout (HEAD^)change files in working dir with git checkout <filename>change file in stage and using git reset HEAD <filename> to remove file from stage and then us git checkout <filename> to be back where started create unwanted commit and then use 'git revert HEAD' to roll back, which pops you into editor.. save and close and back to where were can use 'git reset --hard <tag> to roll back to previous tag - not good in group projects though Can also do a lot more, but this gives basic idea Bruce Scharlau, University of Aberdeen, 2017

Git lets us try new ideas without messing up current work Bruce Scharlau, University of Aberdeen, 2017

Git lets you create branches A repository has a ‘master’ branch of the code and you can create more (just like a tree) for new parts – for example a new feature in the app Bruce Scharlau, University of Aberdeen, 2017

Branches are easy to toss away If you change your mind you can remove a branch – just like lopping off a tree branch Makes it easy to ‘try before you buy’ Bruce Scharlau, University of Aberdeen, 2017

We can also merge a branch to master If we do like the new code we can ‘merge’ it into the master branch of the code and thus drop the branch Bruce Scharlau, University of Aberdeen, 2017

Git works with remote repositories To ensure our code survives beyond our laptop with a remote repository. This removes the hassle of carefully copying the code to other locations via USB sticks, without overwriting versions. Bruce Scharlau, University of Aberdeen, 2017

Use ssh keys for remote repositories Remote repositories are checked using public and private keys instead of logins Git will have set one up for you when it was installed If not follow instructions at … http://git-scm.com/book/en/Git-on-the-Server-Generating-Your-SSH-Public-Key Bruce Scharlau, University of Aberdeen, 2017

Create private repos for your work You can use a private repos at Heroku (not just for Rails apps) Create account and then one repo per project to ensure you don’t loose anything Bruce Scharlau, University of Aberdeen, 2017

Use a repo for ALL coursework Github is payable for private projects, and free only for PUBLIC ones. Check if the Github ‘student’ account covers your needs Use Heroku or Bitbucket instead http://www.heroku.com/ https://bitbucket.org/ Bruce Scharlau, University of Aberdeen, 2017

Using public repos exposes you to plagiarism You are potentially guilty of plagiarism by using public repositories as others can copy your work. Use private repositories for coursework at Bitbucket or Heroku instead Bruce Scharlau, University of Aberdeen, 2017

Bruce Scharlau, University of Aberdeen, 2017 With remote repos you can collaborate on work: ‘undo’ things, ‘try ideas’ and ‘merge’ work Bruce Scharlau, University of Aberdeen, 2017

Collaborate with others via remote repo Remote repos mean we can share our work with collaborators and Git will keep track of who made which change Bruce Scharlau, University of Aberdeen, 2017

Using git in teams takes practice Individuals need to add steps in work when collaborating to avoid creating a mess of their projects Make the effort now to learn this and future group projects will flow much more smoothly Bruce Scharlau, University of Aberdeen, 2017

Teams need workflow method Discuss with the person next to you what workflow is needed with teams using version control Bruce Scharlau, University of Aberdeen, 2017

Local and remote need to be kept synced Teams need something like: Do your work, and then pull changes from remote, then run tests to see what’s broken, then fix code from changes team has made, then test again, then pull remote again to ensure up to date, Only then do you push when all tests pass Bruce Scharlau, University of Aberdeen, 2017

Local and remote need to be kept synced Do your work, and then pull changes from remote Only then do you push when all tests pass then run tests to see what’s broken then fix code from changes team has made, then test again then pull remote again to ensure up to date Bruce Scharlau, University of Aberdeen, 2017

Overlap of agile methods with git usage Team need to prioritise tasks in code, and decide who’s working on what so overlapping work is minimized Use Trello or Issues to track work/tasks https://trello.com/ Bruce Scharlau, University of Aberdeen, 2017

Go add Git to your projects Go back to your ongoing examples and create Git repositories inside each of them. Start using Git repos (both local & remote) for all of your work Bruce Scharlau, University of Aberdeen, 2017

We can deploy to remote sites like Heroku with Git Detailed instructions for use with Cloud 9 at https://www.railstutorial.org/book/beginning#sec-deploying References at https://devcenter.heroku.com/categories/ruby And example https://devcenter.heroku.com/articles/getting-started-with-rails5 Bruce Scharlau, University of Aberdeen, 2017

Why should we bother with Heroku? We can run large apps already on our own systems and C9 and Codio let us show these to others, so why bother with Heroku? Think about this yourself, and then discuss with the person next to you. Bruce Scharlau, University of Aberdeen, 2017

Install Heroku for your system $source<(curl -sL https://cdn.learnenough.com/heroku_install) For Cloud 9 and others download CLI from Heroku – detailed instructions to follow there Then use ‘heroku create’ to add heroku to a git repository and you can use this to deploy git push heroku master Bruce Scharlau, University of Aberdeen, 2017

Bruce Scharlau, University of Aberdeen, 2017 PG and Heroku for Linux Use these instructions for putting Postgresql in your Linux system https://old-homepages.abdn.ac.uk/b.scharlau/pages/blog/?p=361 Install Heroku from details here https://devcenter.heroku.com/articles/heroku-cli and in particular ‘other Linux options’ under ‘standalone installation’ which use the command $ curl https://cli-assets.heroku.com/install.sh | sh Bruce Scharlau, University of Aberdeen, 2017

Modify the Gemfile for Postgresql group :development, :test do gem 'sqlite3’ gem 'byebug', platform: :mri end group :production do gem 'pg' end Use special bundle install so that you don’t need Postygresql on your machine Optional flag $bundle install --without production Bruce Scharlau, University of Aberdeen, 2017

Don’t forget the extras Check Heroku details for more… viewing logs, using database, starting a console Heroku logs – tail (watch the app log) Heroku pg ( database details) Heroku run rake db:migrate https://devcenter.heroku.com/articles/getting-started-with-rails5 Bruce Scharlau, University of Aberdeen, 2017