Tizen/Artik IoT Practice Part 4 Open Source …...Tizen/Artik IoT Practice Part 4 Open Source...
Transcript of Tizen/Artik IoT Practice Part 4 Open Source …...Tizen/Artik IoT Practice Part 4 Open Source...
Embedded Software Lab. @ SKKU
14
1
Sungkyunkwan University
Tizen/Artik IoT Practice Part 4Open Source Development
Embedded Software Lab. @ SKKU
14
2
• SCM Tool: Git
– Version Management
– Local & Remote Repository
– Branch Management
• Github Contribution Process
– Issue
– Fork Project
– Pull Request
Contents
Embedded Software Lab. @ SKKU
14
3
• Working directory– Source code in work– “add” command: adds files/directories to staging
area
• Staging area(index)– Source code to be committed– “commit” command: makes a new version in
repository
• Repository(HEAD)– Source code already committed– Files or directories are stored as content-
addressable objects identifiable by hash value.
Git: Key Concepts
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
Embedded Software Lab. @ SKKU
14
4
• Add a source code, ‘hello.cpp’1. Add hello.c to staging area
1. $ git add hello.c
2. Make a new version1. $ git commit -m “commit message”
• Add all of the source code1. Add all of the source code
1. $ git add --all
2. Make a new version1. $ git commit -m “commit message”
• Display staging area’s status1. $ git status
Git: Version Management (1/2)
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
Embedded Software Lab. @ SKKU
14
5
• Display the commit log
1. $ git log
– Each commit’s hash value, author information, date, message
Git: Version Management (2/2)
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Commit
Addcommit 783c82ff64eda9f03401834de906eca77d01f691Author: Gyeonghwan Hong <[email protected]>Date: Mon Sep 22 10:37:44 2014 +0900
2nd version commit: hello.c is added
commit 712943bb31bf85430e1a027abe197e5b88a26110Author: Gyeonghwan Hong <[email protected]>Date: Thu Aug 28 12:08:17 2014 +0900
1st version commit: hello.h is added
• Return to a previous version
1. git checkout <commit’s hash value>ex. git checkout 712943bb31bf85430e1a027abe197e5b88a26110
Embedded Software Lab. @ SKKU
14
6
• “Commit”
– Make a new version on local repository
Git: Local & Remote Repository (1/2)
• “Push”
– Upload commits in local repository to remote repository
• “Pull”
– Download commits in remote repository to local repository
Local PC
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Github Server (Remote)
(Remote) Repository
Ver.1
hello.h
Ver.2
hello.c hello.h
Pull
Push
Commit
Add
Embedded Software Lab. @ SKKU
14
7
• Upload to remote repository
1. $ git push <remote name> <remote branch>
– ex. $ git push origin master
• Download from remote repository
1. $ git pull
Git: Local & Remote Repository (2/2)
Local PC
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Github Server (Remote)
(Remote) Repository
Ver.1
hello.h
Ver.2
hello.c hello.h
Pull
Push
Commit
Add
Embedded Software Lab. @ SKKU
14
8
• Check the branch list of local repository
1. $ git branch --list
• Check the branch list of remote repository
1. $ git branch --remote
• Move to another branch
1. $ git checkout <branch name>
– ex. $ git checkout feature_x
Git: Branch Management (1/3)
* masterfeature_x
Embedded Software Lab. @ SKKU
14
9
• Develop a new feature by making a new branch
1. Make a new branch ‘feature_x’
1. $ git branch feature_x
2. $ git checkout feature_x
2. Edit and commit source code
Git: Branch Management (2/3)
3. Merge ‘feature_x’ branch to original branch
1. $ git checkout master
2. $ git merge feature_x
Embedded Software Lab. @ SKKU
14
10
• Conflict– When merging feature_y branch to master branch, ‘hello.h’ in
version 2-x and 2-y have different changes each other.
– This situation is called as ‘conflict’.
– The conflict should be resolved by ‘conflict resolution’ process.1. $ git mergetool
Git: Branch Management (3/3)
Embedded Software Lab. @ SKKU
14
11
• Issue
– Suggestion of new feature, bug fix, enhancement in Github community
– After discussion on the issue with project’s collaborators, project’s direction is determined
• Assign an Issue
– Project collaborators can assign an issue to specific developers.
Github Contribution: 1. Issue
Embedded Software Lab. @ SKKU
14
12
• Fork Project
– In order to contribute to Project, fork the Github repository to the own repository, then start to implement the new feature.
Github Contribution: 2. Fork Project
Embedded Software Lab. @ SKKU
14
13
• Fork Project
– Option 1. Clone forked project onto local PC
• $ git clone https://github.com/<your ID>/<repository name>
– Option 2. Add a remote server
• $ git remote add <server name> https://github.com/<your ID>/<repository name>
• $ git pull <server name> <branch name>
Github Contribution: 2. Fork Project
Embedded Software Lab. @ SKKU
14
14
• Pull Request
– Click “New pull request” button, then create pull request message
Github Contribution: 3. Pull Request
– After the review and vote of maintainers, the pull request is determined to be merged or rejected.