Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

Similar documents
Introduction to Git. Database Systems DataLab, CS, NTHU Spring, 2018

Software Development I

G E T T I N G S TA R T E D W I T H G I T

Version Control with Git ME 461 Fall 2018

Human-Computer Interaction Design

Git & Github Fundamental by Rajesh Kumar.

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

Tutorial 2 GitHub Tutorial

The Old World. Have you ever had to collaborate on a project by

FEEG Applied Programming 3 - Version Control and Git II

Git for Version Control

Version control system (VCS)

GIT. CS 490MT/5555, Spring 2017, Yongjie Zheng

Lab Objective. Lab Assignment. Downloads and Installation

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Lab 08. Command Line and Git

Version Control. Version Control

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

Git Setup Help using GitKraken (CSE 154)

Revision Control. How can 4. Slides #4 CMPT 276 Dr. B. Fraser. Local Topology Simplified. Git Basics. Revision Control:

Version Control. Version Control

Human-Computer Interaction Design

Version Control System GIT

Submitting your Work using GIT


Version control with Git.

A BASIC UNDERSTANDING OF VERSION CONTROL

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Windows. Everywhere else

Tips on how to set up a GitHub account:

Online Remote Repositories

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

Introduction to Git and Github

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

MOOSE-Based Application Development on GitLab

DEVNET Introduction to Git. Ashley Roach Principal Engineer Evangelist

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

L Modeling and Simulating Social Systems with MATLAB

Git! Fundamentals. IT Pro Roundtable! June 17, 2014!! Justin Elliott! ITS / TLT! Classroom and Lab Computing!! Michael Potter!

:59:32 PM PST

API RI. Application Programming Interface Reference Implementation. Policies and Procedures Discussion

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

License. Introduction to Version Control with Git. Local Version Control Systems. Why Use Version Control?

Software Revision Control for MASS. Git Basics, Best Practices

Version Control with Git

Salvatore Rinzivillo VISUAL ANALYTICS

Lab Exercise Git: A distributed version control system

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

Managing Network Configurations with Git and GitLab


Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Introduction to Version Control with Git

Intermediate Programming, Spring Misha Kazhdan

Git. Presenter: Haotao (Eric) Lai Contact:

Git better. Collaborative project management using Git and GitHub. Matteo Sostero March 13, Sant Anna School of Advanced Studies

Computer Science Design I Version Control with Git

Revision Control and GIT

Effective Software Development and Version Control

Code and data management with Git

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

Git Introduction CS 400. February 11, 2018

EDA Spring, Project Guidelines

CS 390 Software Engineering Lecture 5 More Git

Git tutorial. Katie Osterried C2SM. October 22, 2015

Improving Your Life With Git

Object Oriented Programming. Week 1 Part 2 Git and egit

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

Github/Git Primer. Tyler Hague

A short tutorial on Git. Servesh Muralidharan 4 March 2014

Tutorial: Getting Started with Git. Introduction to version control Benefits of using Git Basic commands Workflow

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

Version Control: Gitting Started

GUIDE TO MAKE A REAL CONTRIBUTION TO AN OPEN SOURCE PROJECT 1. 1

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

Software Revision Control for MASS. Git Installation / Configuration / Use

CSE 331 Software Design & Implementation

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

Introduction to Version Control using Git

Version Control System - Git. zswu

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

Revision control. INF5750/ Lecture 2 (Part I)

CSE 391 Lecture 9. Version control with Git

How to version control like a pro: a roadmap to your reproducible & collaborative research

A Practical Introduction to git

Django MFA Documentation

Outline The three W s Overview of gits structure Using git Final stuff. Git. A fast distributed revision control system

Visualizing Git Workflows. A visual guide to 539 workflows

School of Computing Science Gitlab Platform - User Notes

Lecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han

Git(Lab) Tutorial and Hands-On

Gitlab Setup/Usage by Yifeng Zhu modified by Vince Weaver 30 January 2019

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

CSE 332: Data Structures and Parallelism Winter 2019 Setting Up Your CSE 332 Environment

TDDC88 Lab 4 Software Configuration Management

Transcription:

Lab 01 How to Survive & Introduction to Git Web Programming DataLab, CS, NTHU

Notice These slides will focus on how to submit you code by using Git command line You can also use other Git GUI tool or built-in Git tool in other IDE/editor

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Teaching Assistants

How to Find Us? Office Hour (TAs) - Wed. 3:30-5:20pm at Delta 723/724 Email (Personal question only) - Yi-Hsuan Wu: yhwu@datalab.cs.nthu.edu.tw - Zheng-Xin Weng: zxweng@datalab.cs.nthu.edu.tw - Wei-Da Chen: wdchen@datalab.cs.nthu.edu.tw - Hsin-Chi Chu: hcchu@datalab.cs.nthu.edu.tw Online Forum - ilms

If I have Question?

If I have Question? Always Google first! Learn how to google is important. If you try your best but still can t catch it. Feel free to ask us on ilms or office hour.

Team Up 2~4 people each team 2 people is accepted if you can do as well as others. Please register your team here before 3/15 23:59 - Register form : https://goo.gl/8dltjd - After that day we will match the rest student.

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Why use version control?

We want to track what we did and when we did it.

Students VCS

How to work with others???

Dropbox VCS in Reality Dropbox VCS in Reality

Why use VCS? Managing your projects - tracking your files and modifications. Synchronization between modifications made by different developers. Revision history is still very helpful even if you work alone.

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Git

Git Git is a popular version control system which is Fast Easy to use Distributed A git repository is a mini database that tracks your files.

Git Workflow (1/2) With a local repository in your computer, you ll need following operations to make git track your work: 1. Create/modify files 2. Let git monitor the files by adding them to staging files. 3. Commit your changes to and git will create snapshots (versions) of the files for you.

Git Workflow (2/2) Modifying Files add modify file Staging Modified Files commit Committing A Version

Git Branch Master Branching Merging Develop

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Be Professional

Basic Git Commands (1/2) git init Initialize a repository at current directory. git add [file_name] Add files to git repository and let git track them. git commit -m "commit messages" Save the changes to the git repository and create snapshots of the files. git checkout [version] Go to a specific version.

1. Find current directory 2. Go to that directory

4. Go to that folder 3. Add a new folder 5. Create a new file 6. Put some contents and save

7. Setup user information With --global: for all repositories in computer Without --global: for current repository $ git config --global user.name "name" $ git config --global user.email "email"

8. Go to git-demo 9. Show the files in git-demo 10. Initialize a Git repository $ cd git-demo # go to git-demo directory $ dir # list the files $ git init # initialize a repository

11. Add HelloGit.txt to staging files 12. Commit your changes # Add HelloGit.txt to staging files $ git add HelloGit.txt # Commit the changes to the repository # where "version 1" is the commit message $ git commit -m "version 1"

13. Make some changes and save 14. Add it and commit again

15. View your versions Version ID Commit messages # Show the versions you ve created so far $ git log

16. Go to a specific version # Go to a specific version $ git checkout {version_id}

LIFE IS TOO SHORT TO TYPE THAT VERSION ID! which is 40 characters long

Version ID 15. Show versions with short version ID 56% shorter! # Show versions with short version id $ git log --oneline

16. Go to a specific version # Go to a specific version. # In fact, you only need to type # the first 5 characters. $ git checkout {short_version_id}

17. Close and reopen HelloGit.txt 18. Back to the version 1!

Try yourself (1/2) Branching steps Creating a new branch git branch [branch name] Checking out the branch git checkout [branch name]

Try yourself (2/2) Merging steps Checking out a branch to merge git checkout [branch 1 name] Merging another branch git merge [branch 2 name]

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Collaboration To work with others using git, you ll need a server that store the repository. Git is distributed, which means Everyone can store a copy of the repository downloaded from the server to their computer and do their jobs independently.

Collaboration Workflows (1/2) 1. If you don t have the project, clone (download) the repository from the server. 2. Do your work and commit the changes at local. Once done, push (upload) the repository to the server. 3. If someone else modified the project, you can pull (sync) the repository to get the updated project. 4. Repeat 2 and 3.

Collaboration Workflows (2/2) Server Clone Clone Local A Local B

Collaboration Workflows (2/2) Commit Server A Local A Local B

Collaboration Workflows (2/2) Push Server A Local A Local B

Collaboration Workflows (2/2) A Server Pull A Local A Local B

Collaboration Workflows (2/2) A Server Pull A A Local A Local B

Why Authentication Failed?

Collaboration Workflow If you tried to clone the code template from a server and want to push the modified file. You will get authentication failed. It s because it was a project of others, which means you are not able to save the changes back to the server. So, how can I copy a project from others on a open source platform like Github?

Introducing Fork

Original Project A A2 Forked Project Open a Merge Request A A1 A2 Forked from Red Commit Commit

A Accept A2 A A1 A2

A A2 A A1 A2

Forked from Red A2 A2 A A2 A A1 A2

Git Collaboration Workflow 1. Fork a repository to make a copy of it. 2. Clone the repository you forked to your workspace. 3. Do your work and commit the changes in your workspace. 4. Push the repository to the server to synchronize them. 5. Open a merge request to origin repository.

Basic Git Commands (2/2) git clone [url] Clone a repository from remote server git push [url] [branch-name] Push committed file to remote server

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Gitlab We have created account for you Account: student ID (e.g. 106012345) Password: webapp+studentid (e.g. webapp106012345)

Workflow For each lab, you should follow the workflow below 1. Fork our template repository on Gitlab 2. Clone the forked repository to your computer 3. Finish your lab 4. Commit in your computer 5. Push to Gitlab 6. Send merge request of your branch to our template repository

Workflow For each lab, you should follow the workflow below 1. Fork our template repository on Gitlab 2. Clone the forked repository to your computer 3. Finish your lab 4. Commit in your computer 5. Push to Gitlab 6. Send merge request of your branch to our template repository

You can access course projects in this group

1. Click to fork

2. Check if this repository is under your account 3. Go to Settings

4. Set project to private

5. Scroll down and save changes

Workflow For each lab, you should follow the workflow below 1. Fork our template repository on Gitlab 2. Clone the forked repository to your computer 3. Finish your lab 4. Commit in your computer 5. Push to Gitlab 6. Send merge request of your branch to our template repository

1. Choose HTTP 2. Copy the link

If You use Windows

3. Create a folder to put your repos 4. Type "git clone {URL}" 5. The repo has been successfully cloned

Workflow For each lab, you should follow the workflow below 1. Fork our template repository on Gitlab 2. Clone the forked repository to your computer 3. Finish your lab 4. Commit in your computer 5. Push to Gitlab 6. Send merge request of your branch to our template repository

1. -A means all files 2. Check if your file is added to git 3. Commit your changes

If you see these message, type git config --global user.name "{name}" git config --global user.email "{email}" {email} is the email you use on gitlab

Workflow For each lab, you should follow the workflow below 1. Fork our template repository on Gitlab 2. Clone the forked repository to your computer 3. Finish your lab 4. Commit in your computer 5. Push to Gitlab 6. Send merge request of your branch to our template repository

Type "git push -u origin master"

Workflow For each lab, you should follow the workflow below 1. Fork our template repository on Gitlab 2. Clone the forked repository to your computer 3. Finish your lab 4. Commit in your computer 5. Push to Gitlab 6. Send merge request of your branch to our template repository

1. Click Merge Requests

2. New merge request

3. Choose the branch you pushed in your repo 4. Choose the branch named after your ID 5. Compare branches

6. Set title to "{ID} Submission" 7. If everything is OK, submit your merge request

Notice

Here!!!!!

Outline General Rule Introduction to Git Version control Git Basics Try Git! Remote Repositories How to Submit Your Code to Gitlab Tools & References

Tools Git GUI - GitKraken Editor / IDE - Visual Studio Code - Atom - Sublime Text - Brackets - Notepad++ - Webstorm

Reference Learn Git branching (interactive) http://pcottle.github.io/learngitbranching/ Pro Git http://git-scm.com/book/ 寫給 大家的 Git 教學 http://www.slideshare.net/littlebtc/git-5528339

Today s exercise Install Git command line tool in your computer. Follow appendix A. Try to submit in GitLab. No score but very important!