Presentation is loading. Please wait.

Presentation is loading. Please wait.

SSE2034: System Software Experiment 3 Spring 2016

Similar presentations


Presentation on theme: "SSE2034: System Software Experiment 3 Spring 2016"— Presentation transcript:

1 SSE2034: System Software Experiment 3 Spring 2016
Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

2 git Distributed version control system

3 git tutorial User setup Create repository Commit Multi version History
New Clone Commit Multi version Branch, checkout, etc. History Log, diff, etc.

4 User Setup git config --global user.name ”user name”
git config --global user. main.example.com

5 New Repository Create new repository mkdir ~/source_code
cd ~/source_code git init JeongHwanjinui-MacBook-Air:~ Hwanjin$ mkdir ~/source_code JeongHwanjinui-MacBook-Air:~ Hwanjin$ cd source_code/ JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git init Initialized empty Git repository in /Users/Hwanjin/source_code/.git/ JeongHwanjinui-MacBook-Air:source_code Hwanjin$ ls -al total 0 drwxr-xr-x 3 Hwanjin staff :20 . drwxr-xr-x+ 36 Hwanjin staff :19 .. drwxr-xr-x 10 Hwanjin staff :20 .git

6 Clone Repository Local clone Remote clone
git clone ~/source_code Remote clone git clone Ex) git clone ong/emacs_config CS258 S99

7 commit git add <file name> or * git commit –m “message” add mv
Add file contents to the index mv Move or rename a file, a directory, or a symlink reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git add * JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git commit -m "first commit" [master (root-commit) 0c9021e] first commit

8 Pull & Push Push your committed changes to the rem ote master repository Pull changes pushed to remote master int o your local copy

9 Pull & Push git push <local> <remote> git pull
Ex) git push origin master git pull

10 Branch Grow, mark and tweak common history

11 Branch JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git branch
* master JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git branch test JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git branch test1 test test1 JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git branch -d test1 Deleted branch test1 (was 0c9021e). JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git branch * master test

12 Checkout

13 Checkout JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git branch
master * test JeongHwanjinui-MacBook-Air:source_code Hwanjin$ ls -al test_file -rw-r--r-- 1 Hwanjin staff :44 test_file JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git checkout master Switched to branch 'master' -rw-r--r-- 1 Hwanjin staff :45 test_file JeongHwanjinui-MacBook-Air:source_code Hwanjin$

14 History - log git log JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git log commit 6029ac48c e59bb3a5cfa47c493d2 Author: Hwanjin Jeong Date: Tue May 17 17:44: test commit 0c9021ea35fa f6e203f436586ad92d28 Date: Tue May 17 17:27: first commit

15 History - diff git diff <commit log id>
JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git diff 0c9021ea35fa f6e203f436586ad92d28 diff --git a/test_file b/test_file index e69de29..9daeafb --- a/test_file +++ b/test_file -0,0 +1 +test

16 Reset git reset --hard <commit log id>
JeongHwanjinui-MacBook-Air:source_code Hwanjin$ ls -al test_file -rw-r--r-- 1 Hwanjin staff :46 test_file JeongHwanjinui-MacBook-Air:source_code Hwanjin$ git reset --hard 0c9021ea35fa f6e203f436586ad92d28 HEAD is now at 0c9021e first commit -rw-r--r-- 1 Hwanjin staff :49 test_file

17 Github world/#repository


Download ppt "SSE2034: System Software Experiment 3 Spring 2016"

Similar presentations


Ads by Google