블로그 이미지
윤영식
Full Stacker, Application Architecter, KnowHow Dispenser and Bike Rider

Publication

Category

Recent Post

2013. 10. 30. 14:31 My Services/PlayHub

프론트 개발을 위해 준비해야할 것들은 무엇이 있을까? 우선 개발 및 테스트 프레임워크와 라이브러리 관리, 테스트/코드커버리지/빌드 자동화 수행등 준비할 것들이 많다. 이것을 한번에 준비하고 자동화할 방법은 없을까?



1. Yeoman

  - yo : 코드 스케폴딩 역할 (프로젝트를 시작할 때 최초에 디렉토리구조와 템플릿 파일일 제공해 준다) generator-* 로 시작

  - grunt : test, lint, concatenate, build등 Java의 Ant와 같은 Task를 자동 수행

  - bower : 내부적으로 사용하는 컴포넌트의 버전 의존성 관리 및 설치/업데이트/삭제 관리

  - 참조 



2. Addy Osmani의 Frontend Workflow

  - 자동화는 반복적인 작업을 효율적으로 만드는 과정

  - Frontend Automation = Scaffolding + Download Libraries + Download Template + Download Framework



3. PlayHub Workflow 만들기 

  - 자신의 개발환경에 GitHub 저장소 설정하기

    + mac 또는 windows

    + nitrous.io 같은 PaaS 에도 설정가능 

// Node Version Manager 설치 

$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh

$ exit

logout

Connection to 127.0.0.1 closed.


// 현재 CentOS에 설치된 Node version 정보가 나오고 원하는 버전정보를 선택하여 사용할 수 있다. 명령은 help 참조

$ nvm list

       N/A

current: v0.11.5


// playhub 디렉토리 만듦 - 해당 디렉토리 밑으로 playhub의 저장소를 놓을 것임 

$ mkdir playhub 


// playhub의 저장소를 git clone하기 위하여 자신의 ssh 공개키가 없다면 생성한다

// 생성방법 참조

$ cd .ssh

$ ssh-keygen -t rsa -C ysyun@yuwin.co.kr  // 이후 쭉 enter

Generating public/private rsa key pair.

Enter file in which to save the key (/home/vagrant/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/vagrant/.ssh/id_rsa.

Your public key has been saved in /home/vagrant/.ssh/id_rsa.pub.

The key fingerprint is:

8a:32:de:ef:de:fd:22:8f:8d:38:70:b0:d7:56:e1:da ysyun@yuwin.co.kr

The key's randomart image is:

+--[ RSA 2048]---+

|                            |

|          .                 |

|         . .                |

|    .     o                |

|     o .S+               |

|    o.o.+ E              |

|  o .+..                  |

| . +  .o.=.              |

|  . .+=.+o+o.         |

+------------------+

$ ssh-add id_rsa

Could not open a connection to your authentication agent.


// 두개의 id_rsa 파일 생성 

$ ls -lart

-rw-rw-r--  1 vagrant vagrant  399 2013-10-30 05:59 id_rsa.pub

-rw-------  1 vagrant vagrant 1675 2013-10-30 05:59 id_rsa

drwx------  2 vagrant root    4096 2013-10-30 05:59 .


$ cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyvfJRNE/Kx+VwuGcQX8+PYbFadT6mCLZ1.. 중략 ..XS0U0uQ== ysyun@yuwin.co.kr


// GitHub -> "Account Settings" -> "SSH Keys"에서 SSH key값 등록



// 이제 GitHub에서 PlayHub의 Palette를 clone 해 보자 (git 기본 설치를 전제로 함)

$ cd ../playhub/

$ git clone git@github.com:playground-ko/palette.git

Initialized empty Git repository in /home/vagrant/playhub/palette/.git/

.. 중략 ..


$ ls - lart

drwxr-xr-x  5 vagrant vagrant 4096 2013-10-30 06:07 palette


// submodule에 대하여 초기화 하고 업데이트 한다 (Git 환경만들기 참조)

$ cd palette

$ git submodule init

Submodule 'backend' (git@github.com:playground-ko/palette.backend.git) registered for path 'backend'

Submodule 'frontend' (git@github.com:playground-ko/palette.frontend.git) registered for path 'frontend'

$ git submodule update

Initialized empty Git repository in /home/vagrant/playhub/palette/backend/.git/

.. 중략 ..

Submodule path 'backend': checked out 'f8276822e8a12a15f2af19e0c62cbd74a9172d84'

Initialized empty Git repository in /home/vagrant/playhub/palette/frontend/.git/

.. 중략 ..

Submodule path 'frontend': checked out 'e1b7201011321e1df2cc990c4eb2042c765c8a3c'


// playhub 디렉토리로 이동하여 bankend, frontend 저장소를 별도로 받아서 개발을 시작한다 

$ cd ..

$ git clone git@github.com:playground-ko/palette.backend.git

Initialized empty Git repository in /home/vagrant/playhub/palette.backend/.git/

.. 중략 ..

$ git clone git@github.com:playground-ko/palette.frontend.git

Initialized empty Git repository in /home/vagrant/playhub/palette.frontend/.git/

.. 중략 ..


  - yo/grunt/bower, generator-angular 를 설치 또는 업그레이드 하고, frontend 디렉토리로 이동하여 프로젝트를 만든다 

// yo를 설치하면 grunt와 bower가 같이 설치된다 

sudo npm install -g yo

// 현재 버전은 1.0.4 (2013.10.31 기준)

$ yo --version

1.0.0-rc.1.4

$ grunt --version

grunt-cli v0.1.9

grunt v0.4.1

$ bower --version

1.2.7


// 이미 설치되어 있다면 최신버전으로 업데이트  한다 

$ sudo npm update -g yo

$ sudo npm update -g grunt-cli

$ sudo npm update -g bower


// angular framework 설치

sudo npm install -g generator-angular


// angular 웹앱을 만든다 

$ cd  palette.frontend/

$ yo angular Palette


// 빌드하면 배포할 수 있는 dist 배포 디렉토리가 나온다. 

// dist는 온전한 html, css, js 파일들이고 이것은 어느 웹서버에 가져다 놓아도 구동이 된다

// 즉, 굳이 node.js위에 구동되지 않아도 됨 

// 기본적으로 build를 하면 관련 js 파일을 minification하여 사이즈를 줄여준다 

// Sublime Text에 Grunt build를 설정할 수 있다

$ grunt build

// karma 통하여 unit, e2e 테스트 수행

$ grunt test

// node.js 기반으로 서버가 열리면서 브라우져(Chrome)도 자동으로 열린다 

$ grunt server


// dist 배포본은 python을 통하여 간단히 테스트 해 볼 수도 있다 

// 브라우져에서 8000 port를 열어서 배포본이 정상적으로 작동하는지 아이체킹

$ cd dist 

python -m SimpleHTTPServer 8000


이제 Frontend를 Yeoman을 통하여 개발해 보자



4. BootFlat 적용하기 

  - yeoman의 generator-bootstrap은 v2.* 버전이 적용되어 있다. Bootstrap v3.* 버전이 적용된 BootFlat 확장판을 적용하기 위한 방법은 기존 블로깅을 참조한다. 

  - Twitter Bootstrap 고도화



<참조>

  - Yeoman을 통해 AngularJS 프로젝트 자동 구성하기

  - nvm 설치 방법

  - GitHub을 위한 SSH 키 생성방법

  - Sublime Text에 Grunt build 설정하기

  - BootFlat Homepage

posted by 윤영식
2013. 9. 24. 11:37 My Services/Smart Visualization

"엑셀로 통계 차트 그리기 어렵다" 

"쉽고 빠르게 이동평균 선을 보고 싶다"



왜?

End User가 모니터링 중인 미들웨어(JBoss)에 대한 Resource Usage/TPS/Response Time등의 분기별 통계 정보를 요구한다. 3개월 또는 6개월 단위 raw data를 그냥 엑셀에 담아서 전달하는 것은 의미가 없고, 엑셀의 차트를 그려도 일정한 패턴을 찾기 어렵지 않을까 생각되어 이동평균선 차트를 만들어서 전달해 주기로 하였다. Raw Data는 엑셀파일로 export가 되므로 .csv 확장자로 파일을 업로드하면 바로 이동평균 차트가 나오는 서비스를 만들어 널리 편히 쑤메 그 패턴(우상향, 우하향)을 인지하여 미들웨어가 정상적으로 운영되고 있는지 장기적인 관점(Capcity Plan)에서 판단근거를 세우고자 한다



들어가면서

  - 비즈니스 모델 캔버스 : 이런건 작성안함. 내가 필요해서 하는 서비스임. 

  - Lean Development : Agile Scrum방식으로 진행을 한다. 빠르게 만들고 배포하고 피드백받아 학습하면서 고도화해 간다 

    + 도구로 Trello을 사용할 예정이며 간략히 Specification(SRS)도 이곳에 정리한다 

    + Public 저장소로 GitHub을 사용하고, GitHub Commit때 마다 Travis를 통하여 지속적인 배포를 한다  

  - Lean UX : Service Desgin 에 대해서 조금 접근해 본다. 

    + 누군가 같이 할 수 있다면(3명가량) 서비스 디자인 툴킷 사용해서 워크샵 해보고 싶다 

  - RWD : Responsive Web Design (반응형 웹) 을 통해 다양한 스마트 기기에서 볼 수 있도록 한다 

  - 그동안 검토한 기술과 환경들에 대한 파일럿 성격의 서비스 구현체를 만들어 보는데 의의가 있다



어떻게 

  - SPA : Single Page Application으로 만들것이다. SPA Framework으로 AngularJS를 사용한다 

  - MEAN : MongoDB + Express + AngularJS + NodeJS를 기술스택으로 사용한다 

  - Yeoman : Yeoman의 scafolding 기능을 통하여 SPA 환경을 최초에 구성하고 개발할 것임 (include Grunt, Bower)

  - D3.js : Data Driven Documents Framework을 기반하여 HTML5의 svg를 이용한 차트 라이브러리인 NVD3.js 를 사용한다 

  - Heroku : PaaS에 서비스를 올려서 공개한다 

  - 서비스 소개는 GitHub에 프로젝트 Page를 만들어서 공개한다. 소스도 물론 퍼블릭 공개한다 

  - 서비스 진행과정은 블로그에 정리하고 SPA 초기 개발하는 분들이 참조토록 한다 



무엇을

  - Smart Visualization : 엑셀 수치 데이터를 이동평균 차트로 보여주는 서비스 

  


향후 하고 싶은 것

  - 다양한 통계 정보를 자동으로 차트에 표현해 보고 싶다 

  - Hadoop을 이용하여 BigData 연산 배치 처리 결과를 차트로 표현해 보고 싶다 

 

posted by 윤영식
2013. 9. 7. 12:56 Git, GitHub/GitHub

깃헙에 아이디를 가지고 있다면 http://<id>.github.io 형식의 정적 홈페이지를 만들어 퍼블리싱 할 수 있다. AngularJS와 Bootstrap을 가지고 린(Lean)하게 자신의 홈페이지를 만들어 보자. 자신의 홈페이지를 한두시간만에 만들 수 있다. AngularJS와 Bootstrap을 사용하기 때문에 정적 홈페이지를 SPA(Single Page Application) 타입으로 클라이언트(브라우져)에서 서버의 도움(통신)없이 애플리케이션처럼 구동 될 수 있도록 만들 수 있다.  예) 쥔장 홈페이지 : http://ysyun.github.io/



1. 깃헙 계정 및 레파지토리

  - https://github.io/ 에서 계정을 만든다 

  - <id>.github.io 레파지토리를 만든다. 예) 계정이 ysyun 이라면 레파지토리는 ysyun.github.io (저장소 이미 만들었음)

     * 주의 : <id>.github.com 이 아니라 <id>.github.io 이다. 

  

  - 로컬 PC에서 git clone 한다 

$ git clone https://github.io/<ID>/<ID>.github.io.git

예)

$ git clone https://github.io/ysyun/ysyun.github.io.git

   


2. AngularJS와 Bootstrap 템플릿 사용하기

  - AngujarJS+Bootstrap Seed를 git clone 한다 

$ git clone https://github.io/lbehnke/angularjs-bootstrap-seed.git

$ cd angularjs-bootstrap-seed/app 


//app 디렉토리에 있는 모든 파일을 <ID>.github.io 디렉토리에 copy한다

$ copy *  <id.github.io 디렉토리>


  - index.html 에서 보여주고 싶은 메뉴를 수정한다. 반드시 메인 페이지는 index.html이고 root 에 위치해야한다

    간단한 자기소개와 그동안 만들었던 제품에 대한 포트폴리오를 넣었다 

<!-- Navigation -->

    <div class="navbar navbar-inverse navbar-fixed-top">

        <div class="navbar-inner">

            <div class="container">

                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">

                    <span class="icon-bar"></span>

                    <span class="icon-bar"></span>

                    <span class="icon-bar"></span>

                </a>

                <a class="brand" href="#/intro">Yun Young Sik</a>

                <div class="nav-collapse collapse">

                    <ul class="nav">

                        <li class="active"><a href="#/intro">Intro</a></li>

                        <li class="dropdown">

                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Portfolio <b class="caret"></b></a>

                            <ul class="dropdown-menu">

                                <li><a href="#/smartdashboard">Smart Dashboard</a></li>

                                <li><a href="#/edashboard">Pharos e-Dashboard</a></li>

                                <li><a href="#/pharosjava">Pharos Java</a></li>

                            </ul>

                        </li>

                        <!-- <li><a href="#/contact">Contact</a></li> -->


                    </ul>

                </div><!--/.nav-collapse -->

            </div>

        </div>

    </div>


  - app.js 에서 routing정보를 수정한다. AngularJS의 routing 정보이다 

angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives']).

  config(['$routeProvider', function($routeProvider) {

    $routeProvider.when('/intro', {templateUrl: 'partials/intro.html', controller: GenericViewCtrl});

    $routeProvider.when('/smartdashboard', {templateUrl: 'partials/smartdashboard.html', controller: GenericViewCtrl});

    $routeProvider.when('/edashboard', {templateUrl: 'partials/edashboard.html', controller: GenericViewCtrl});

    $routeProvider.when('/pharosjava', {templateUrl: 'partials/pharosjava.html', controller: GenericViewCtrl});

    $routeProvider.when('/project_b', {templateUrl: 'partials/project_b.html', controller: GenericViewCtrl});

    $routeProvider.when('/contact', {templateUrl: 'partials/contact.html', controller: ContactViewCtrl});

    $routeProvider.when('/imprint', {templateUrl: 'partials/imprint.html', controller: GenericViewCtrl});

    $routeProvider.otherwise({redirectTo: '/intro'});

  }]);



3. GitHub Push

  - git push를 통하여 <id>.github.io 레파지토리에 올린다 

$ git push

Counting objects: 10, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (6/6), done.

Writing objects: 100% (6/6), 680 bytes | 0 bytes/s, done.

Total 6 (delta 4), reused 0 (delta 0)

To https://github.io/ysyun/ysyun.github.io.git

   328f41e..ca12f7e  master -> master


  - push하고 5~10분후에 http://<ID>.github.io 을 호출한다 (웹퍼블리싱에 약간의 시간이 소요된다)


두시간 정도만 투자해 보자. 여러분의 멋진 github 홈페이지를 가질 수 있다 



<참조>

  - http://ID.github.io 홈페이지 만들기 

  - github-pages

posted by 윤영식
2013. 8. 14. 09:16 CI/Jenkins, Travis

로컬 프로그램을 GitHub에 push하고 테스트 프로그램을 작성하였다면 이제 자동화 통합 빌드 툴인 Travis와 연동하고, 빌드의 결과를 GitHub에 표시하는 방법에 대해서 알아본다 



1. 사전 준비사항

  - 소스의 root에 .travis.yml 파일을 생성하고 환경값을 작성한다 

  - Node.js에 대하여 환경값을 작성해 본다 

// .travis.yml 내역 

language: node_js

node_js:

  - "0.11"

  - "0.10"

  - "0.8"

  - GitHub에 설정된 모습 : GitHub .travis.yml 참조

    

  - Travis의 default test 명령은 "npm test" 이므로 package.json파일안에 test 명령 script를 작성한다

    (package.json은 "npm init" 명령으로 만든다)

// package.json 내역 

{

  "name": "mobiconStatistics",

  "version": "0.0.1",

  "description": "include statistics function such as the moving average",

  "main": "./lib/mobiconStatistics.js",

  "dependencies": {

    "underscore": "~1.5.1"

  },

  "devDependencies": { 

    "mocha": "latest",

    "should": "~1.2.2"

  },

  "scripts": {

    "test": "mocha test/*.js"

  },

  "repository": {

    "type": "git",

    "url": "https://github.com/ysyun/mobiconStatistics.git"

  },

  "keywords": [

    "mobicon",

    "statistics",

    "movingAverage"

  ],

  "author": "yun youngsik",

  "license": "MIT",

  "bugs": {

    "url": "https://github.com/ysyun/mobiconStatistics/issues"

  }

}



2. GitHub 저장소 환경 설정

  - 저장소에 .travis.yml 파일이 존재한다면 이제 해당 저장소를 접근하기 위한 환경을 설정한다 

  - GitHub의 저장소의 우측 밑에 보면 설정 아이콘을 클릭한다 

    

  - 다음 화면 좌측 메뉴에서 "Service Hooks"을 선택한다 

    

  - Service Hooks 화면밑으로 내려오면 "Travis"가 존재하고 선택한다

    

  - Travis를 선택하면 우측으로 입력과 선택 폼이 나오는데 "Active"를 체크하고 "Update Settings"를 클릭한다 

    

  - GitHub에서의 설정작업은 이제 끝났다. Travis 설정 참조 문구 내역

Travis CI is a distributed build platform for the open source community.

By enabling this hook, Travis CI will listen to push and pull request events to trigger new builds, member and public events to keep track of repository visibility and issue comment events to allow users to talk to @travisbot.

Install Notes

We recommend using the Travis profile page at http://travis-ci.org/profile to manage your hooks.

  1. Create an account at http://travis-ci.org (you can sign in with GitHub)
  2. Enter your credentials
    • The token which you can find on the Travis profile page
    • optional: Enter the username who the Travis token belongs to (defaults to the repository owner)
    • optional: Enter the host of your Travis installation (defaults tohttp://notify.travis-ci.org), the protocol-prefix is optional and defaults to "http://".
  3. Make sure the "Active" checkbox is ticked, and click "Update Settings".
  4. Click on the "Travis" service name and then click the "Test Hook" link.
  5. You should receive an email from Travis once the build has completed

For more details about Travis, go to http://about.travis-ci.org/docs/



3. Travis CI 환경 설정 

  - https://travis-ci.org/ 로 와서 자신의 GitHub 계정으로 로그인을 한다 

  - https://travis-ci.org/profile 로 들어오면 자신의 계정에 Create, Fork한 저장소 목록을 볼 수 있다 

    

 - 저장소 목록의 우측을 보면 "ON/OFF" 스위치가 있다. Travis CI를 원하는 저장소를 "ON" 시킨다 

    

 - https://travis-ci.org/ 로 다시 들어가면 자신의 계정에 대해 설정해 놓은 저장소의 빌드 결과가 출력된다

    

  - Travis CI 설정작업이 끝났다. 이제 GitHub 저장소로 변경내역을 Push할 때 마다 .travis.yml에 설정한 Node.js 버전별로 자동으로 빌드가 이루어진다

  - Travis CI에서 빌드 진행 내역을 확인하는 방법 : "Build Matrix" -> Job 선택

    "npm test" 가 수행되어 테스트 코드가 정상수행된 것을 볼 수 있다 

    




4. GitHub 저장소에 Travis 빌드 아이콘 설정

  - GitHub 저장소에 자신의 변경내역을 push하고 Travis의 빌드 결과(성공/실패)를 아이콘으로 표현해 보자 

  - https://travis-ci.org/ 에서 저장소를 선택하면 우측 결과 화면 위쪽에 톱니바퀴 설정 아이콘이 나온다. "Status Images"를 선택한다

    

  - "Status Images"를 선택하고 Markdown의 내역을 복사한다 

   

  - Markdown 복사 내역은 GitHub 저장소의 README.md 파일에 넣기 위함이다. GitHub 저장소로 이동하여 README.md파일을 Edit 하고 commit 한다 

    

  - 최종 화면이 다음과 같이 나오면 성공! 다음부터 저장소에 push한 애플리케이션의 Test코드가 실패하면 빨간 아이콘이 나올 것이다  

    

 

 

<참조>

  - Travis Build Configuration & CI Environment

  - Travis Node.js Configuration

  - Mobicon Statistics in Travis : 이동평균을 구하는 모듈을 만들어 보았다. 테스트는 Mocha + should.js 기반

'CI > Jenkins, Travis' 카테고리의 다른 글

[Jenkins] 설치후 Security 설정하기  (0) 2013.01.07
[Jenkins] Jenkins와 Gradle 그리고 JavaScript  (0) 2012.12.26
posted by 윤영식
2013. 4. 25. 11:45 Dev Environment/Build System

구글 플러스 보다가 여맨 개발자인 오스마니님의 Generator 문서 정리했다는 글을 보고 얼른 들어와 봤다. AngularJS를 하면서 Yeoman을 필수로 상요하고 있어서 필요한 모듈이나 라이브러리를 스케폴딩하도록 수정하고 있기 때문에 어째 잘 정리되었는지 살펴본다 



1. 소개

  - 제너레이터의 종류는 두가지이다 

    + Boilerplate : 프로젝트 껍데기를 만들어준다. 프로젝트 구조화에 도움 예) HTML5 boilerplate, Twitter Bootstrap boilerplate 등 

    + Scaffolder : boilerplate외에 빌드시스템, sub-generator, 의존성관리, 자동화 업무수행(workflow)을 한다 

  - 공식적인 제너레이터들을 사용하거나 fork해서 수정 사용해도 된다 예) AngularJS+Express 연동



2. Boilerplate  Generator 만들기 

  - awesome 이란 걸 만들어 보자 

    + 원문은 사실 왜 이렇게 명령을 하는지 친절하게 설명은 하지 않고 있다. 기본은 알고 있다는 전제로 간단히 설명했다 

    + html5 boilerplate generator를 만들어 본다 

///////////////////////////////////////////////////////

// yeoman의  boilerplate generator를 가장 먼저 클론한다

$ git clone git://github.com/addyosmani/generator-boilerplate.git

Cloning into 'generator-boilerplate'...

.. 중략..

Resolving deltas: 100% (20/20), done.


///////////////////////////////////////////////////////

// git submodule add 명령(참조) 을 통하여 html5 bp 클론

// 여기서 중요한 것은 app/templates 으로 반드시 지정

// app/templates은 yeoman의 복제 템플릿이 놓이는 위치

// 다른 방법 : yo boilerplate https://github.com/h5bp/html5-boilerplate/archive/master.tar.gz

$ cd generator-boilerplate/

$ generator-boilerplate> git submodule add git://github.com/h5bp/html5-boilerplate.git app/templates

Cloning into 'app/templates'...

remote: Counting objects: 4955, done.

..중략...

warning: LF will be replaced by CRLF in .gitmodules.

The file will have its original line endings in your working directory.


///////////////////////////////////////////////////////

// templates 밑으로 html5-boilerplate 코드가 들어감

$ tree

.

├── README.md

├── app

│   ├── index.js

│   └── templates

│       ├── 404.html

│       ├── CHANGELOG.md

│       ├── CONTRIBUTING.md

│       ├── LICENSE.md

│       ├── README.md

│       ├── apple-touch-icon-114x114-precomposed.png

│       ├── apple-touch-icon-144x144-precomposed.png

│       ├── apple-touch-icon-57x57-precomposed.png

│       ├── apple-touch-icon-72x72-precomposed.png

│       ├── apple-touch-icon-precomposed.png

│       ├── apple-touch-icon.png

│       ├── crossdomain.xml

│       ├── css

│       │   ├── main.css

│       │   └── normalize.css

│       ├── doc

│       │   ├── TOC.md

│       │   ├── crossdomain.md

│       │   ├── css.md

│       │   ├── extend.md

│       │   ├── faq.md

│       │   ├── html.md

│       │   ├── js.md

│       │   ├── misc.md

│       │   └── usage.md

│       ├── favicon.ico

│       ├── humans.txt

│       ├── img

│       ├── index.html

│       ├── js

│       │   ├── main.js

│       │   ├── plugins.js

│       │   └── vendor

│       │       ├── jquery-1.9.1.min.js

│       │       └── modernizr-2.6.2.min.js

│       └── robots.txt

└── package.json


7 directories, 34 files


///////////////////////////////////////////////////////

// git 상태정보 .gitmodule 모듈 환경파일 자동 생성됨 

$ git status

warning: LF will be replaced by CRLF in .gitmodules.

The file will have its original line endings in your working directory.

# On branch master

# Changes to be committed:

#   (use "git reset HEAD <file>..." to unstage)

#

# modified:   .gitmodules

# new file:   app/templates

#


$ cat .gitmodules

[submodule "app/templates"]

path = app/templates

url = git://github.com/h5bp/html5-boilerplate.git


$ cat .git/config

[core]

repositoryformatversion = 0

filemode = true

bare = false

logallrefupdates = true

ignorecase = true

precomposeunicode = false

[remote "origin"]

url = git://github.com/addyosmani/generator-boilerplate.git

fetch = +refs/heads/*:refs/remotes/origin/*

[branch "master"]

remote = origin

merge = refs/heads/master

[submodule "app/templates"]

url = git://github.com/h5bp/html5-boilerplate.git


///////////////////////////////////////////////////////

// Node.js는 기본 설치되어 있어야 한다

// node package manager를 통하여 yeoman관련 모듈설치

$ npm install


  - 원문에서 다음으로 자신이 원하는 프로젝트를 만들라고 하는데, 중간과정이 생략되었다. 이제 만든 generator-boilerplate  사용법을 보자 

///////////////////////////////////////////////////////

// awesome이라는 명칭으로 변경한다

// yeoman 명명규칙으로 generator- prefix는 꼭 붙인다

// package.json 과 README.md 파일 내역을 수정한다 

$ mv generator-boilerplate generator-awesome

$ cd generator-awesome

$ vi package-json  // 이름과 버전 및 설명을 수정

$ vi README.md   // 내용 수정


///////////////////////////////////////////////////////

// yo 명령은 node를 기반으로 한다. 

// 따라서 global하게 찾을 수 있게 node_modules 밑에

// symbolic link을 걸어주었다

$ cd /usr/local/lib/node_modules

$ sudo ln -s <Your Directory Full Path>/generator-awesome  generator-awesome

Password:

/usr/local/lib/node_modules> ls -alrt

 ..중략..

drwxr-xr-x  13 nobody  staff   442  4 12 13:45 generator-karma

drwxr-xr-x  18 nobody  staff   612  4 12 14:30 npm

drwxr-xr-x  15 nobody  staff   510  4 12 14:31 bower

drwxr-xr-x  13 nobody  staff   442  4 12 15:03 grunt-cli

drwxr-xr-x   7 nobody  staff   238  4 18 09:57 yo

drwxr-xr-x  26 nobody  staff   884  4 18 10:42 generator-angular

drwxr-xr-x  16 nobody  staff   544  4 18 16:59 grunt-init

drwxr-xr-x  10 nobody  staff   340  4 19 23:46 grunt-express

drwxr-xr-x  16 nobody  staff   544  4 19 23:46 grunt

drwxr-xr-x  16 nobody  staff   544  4 22 11:04 generator-express

drwxr-xr-x  14 nobody  staff   476  4 22 11:31 generator-generator

drwxr-xr-x  13 nobody  staff   442  4 22 11:44 generator-bootstrap

lrwxr-xr-x   1 root    wheel    48  4 22 17:08 generator-angular-sd -> /Users/development/generator-angular-sd

drwxr-xr-x  16 nobody  staff   544  4 24 15:15 jshint

lrwxr-xr-x   1 root    wheel    52  4 25 10:40 generator-awesome -> /Users/prototyping/yeoman/generator-awesome


$ yo -h

Please choose a generator below.

Awesome

  awesome:app


///////////////////////////////////////////////////////

// 자신의 프로젝트 디렉토리를 만든다 

// 프로젝트 디렉토리로 이동하여 yo awesome 수행! 

$ mkdir  dowonProject 

$ cd dowonProject

 yo awesome  (또는 yo awesome:app)

Generating from Generator Boilerplate v0.1.4...

   create .gitattributes

 .. 중략 ..

   create js/vendor/jquery-1.9.1.min.js

   create js/vendor/modernizr-2.6.2.min.js

   create robots.txt



3. Scaffolding Generator 만들기 

  - generator-generator 를 사용하여 만든다 

///////////////////////////////////////////////////////

// 사실 yo, bower, grunt-cli를 설치해야 한다 (참조)

// 스케폴딩 제너레이터를 만들어 주는 제너레이터 설치

$ sudo npm install -g yo

$ sudo npm install -g generator-generator


///////////////////////////////////////////////////////

// 사용할 수 있는 yeoman generator list를 보자 

$ yo -h 

Generator

  generator

  generator:app

  generator:subgenerator


///////////////////////////////////////////////////////

// 스케폴딩 제너레이터 디렉토리를 만들고 명령수행

// generator- 는 반드시 붙인다. 뒤에 오는 이름에는 

// 절대로 - 를 사용하지 않는다. underbar 사용함!

$ mkdir generator-angularjs_express

$ cd generator-angularjs-express

$ yo generator:app

     _-----_

    |       |

    |--(o)--|   .--------------------------.

   `---------´  |    Welcome to Yeoman,    |

    ( _´U`_ )   |   ladies and gentlemen!  |

    /___A___\   '__________________________'

     |  ~  |

   __'.___.'__

 ´   `  |° ´ Y `


Would you mind telling me your username on Github? (someuser) ysyun

What's the base name of your generator? (generator-angularjs_express)

   create package.json

   create .editorconfig

   ..중략..

   create app/templates/_component.json

npm http GET https://registry.npmjs.org/yeoman-generator


/////////////////////////////////////////////////////////////////

// app 밑으로 index.js 파일과 templates 폴더 생성

// yo 는 generator 밑의 폴더(여기선 app하나) 밑에 기본

// index.js 를 찾고 해당 파일을 수행한다 

// 즉, app가 있으므로 향후 명령은 yo angularjs-express:app 가 된다 

//

// mocha와 yeoman-generator가 설치됨

tree

.

├── LICENSE

├── README.md

├── app

│   ├── index.js

│   └── templates

│       ├── _component.json

│       ├── _package.json

│       ├── editorconfig

│       ├── jshintrc

│       └── travis.yml

├── node_modules

│   ├── mocha

│   └── yeoman-generator

├── package.json

└── test

    ├── test-creation.js

    └── test-load.js


/////////////////////////////////////////////////////////////////

// app이외의 다른 generator를 만들고 싶다면 subgenerator 이용

$ yo generator:subgenerator dowon

   create dowon/index.js

   create dowon/templates/somefile.js


$ cat index.js

'use strict';

var util = require('util');

var yeoman = require('yeoman-generator');


var DowonGenerator = module.exports = function DowonGenerator(args, options, config) {

  // By calling `NamedBase` here, we get the argument to the subgenerator call

  // as `this.name`.

  yeoman.generators.NamedBase.apply(this, arguments);


  console.log('You called the dowon subgenerator with the argument ' + this.name + '.');

};


util.inherits(DowonGenerator, yeoman.generators.NamedBase);


DowonGenerator.prototype.files = function files() {

  this.copy('somefile.js', 'somefile.js');

};


/////////////////////////////////////////////////////////////////

// angularjs-express라고 만든 Scaffoliding generator 사용하기 

/usr/local/lib/node_modules> sudo ln -s <your full path>/generator-angularjs_express generator-angularjs_express

/usr/local/lib/node_modules> yo -h


Angularjs_express

  angularjs_express:app

  angularjs_express:dowon


////////////////////////////////

// 이제 명령어를 사용할 수 있다

$ yo angularjs_express:app 또는 dowon


다음에는 index.js 확장하는 방법을 알아보자 



<참조> 

  - 원문 : http://yeoman.io/generators.html

posted by 윤영식
2013. 4. 9. 10:49 Git, GitHub/GitHub

.gitignore 설정을 깜빡하고 설정하지 않은 상태에서 git remote(GitHub)로 push 하였을 경우 삭제하는 방법



1) 삭제하기 

  - webstorm의 .idea 디렉토리가 GitHub에 push가 되었음 

  - .idea 를 삭제하자 

  


  - 명령수행 3 단계계

$ ll

total 24

-rw-r--r--   1 nulpulum  staff   59  4  6 16:04 component.css

-rw-r--r--   1 nulpulum  staff  473  4  9 09:30 component.js

-rw-r--r--   1 nulpulum  staff  633  4  9 09:30 component.html

drwxr-xr-x  12 nulpulum  staff  408  4  9 09:30 ..

drwxr-xr-x   6 nulpulum  staff  204  4  9 09:30 .

drwxr-xr-x  12 nulpulum  staff  408  4  9 09:56 .idea

$ git rm -r --cached .idea

rm 'angularjs/component/.idea/.name'

rm 'angularjs/component/.idea/component.iml'

rm 'angularjs/component/.idea/dictionaries/nulpulum.xml'

rm 'angularjs/component/.idea/encodings.xml'

rm 'angularjs/component/.idea/jsLibraryMappings.xml'

rm 'angularjs/component/.idea/misc.xml'

rm 'angularjs/component/.idea/modules.xml'

rm 'angularjs/component/.idea/scopes/scope_settings.xml'

rm 'angularjs/component/.idea/vcs.xml'

rm 'angularjs/component/.idea/workspace.xml'

$ git commit -m "remove webstorm .idea directory"

[master 80de3cc] remove webstorm .idea directory

 10 files changed, 352 deletions(-)

 delete mode 100644 angularjs/component/.idea/.name

 delete mode 100644 angularjs/component/.idea/component.iml

 delete mode 100644 angularjs/component/.idea/dictionaries/nulpulum.xml

 delete mode 100644 angularjs/component/.idea/encodings.xml

 delete mode 100644 angularjs/component/.idea/jsLibraryMappings.xml

 delete mode 100644 angularjs/component/.idea/misc.xml

 delete mode 100644 angularjs/component/.idea/modules.xml

 delete mode 100644 angularjs/component/.idea/scopes/scope_settings.xml

 delete mode 100644 angularjs/component/.idea/vcs.xml

 delete mode 100644 angularjs/component/.idea/workspace.xml

$ git push origin master

Counting objects: 7, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (4/4), done.

Writing objects: 100% (4/4), 472 bytes, done.

Total 4 (delta 2), reused 0 (delta 0)

To https://github.com/ysyun/prototyping.git

   cc17d3a..80de3cc  master -> master


  - .idea 디렉토리가 삭제되었음 


  - git rm 옵션들

$ git rm -r --help

usage: git rm [options] [--] <file>...


    -n, --dry-run           dry run

    -q, --quiet              do not list removed files

    --cached                 only remove from the index

    -f, --force               override the up-to-date check

    -r                           allow recursive removal

    --ignore-unmatch      exit with a zero status even if nothing matched




<참조>

  - 원문 : Remove directory from remote repositories

posted by 윤영식
2013. 1. 30. 15:36 Git, GitHub/Git Lec02

공개팀으로 Git을 운영하는데는 비공개팀과 약간의 차이가 있다. 공개팀 운영시에는 모든 사람이 공유 저장소에 대해서 쓰기 권한이 없기 때문이다. 프로젝트 관리자는  Fork를 지원하는 Git 호스팅에서 -GitHub- 기여하는 방법에 대해 가이드 해야 한다. GitHub을 예로 Pull Request는 어떤 절차로 이루어 질까?



1) 갑순이 Fork 질 하기 

  - 갑순이 중앙 저장소(예, ysyun)의 GitHub에서 Fork질 하여 자신의 원격 저장소(예, nulpulum)를 하나 만든다  

    + GitHub의 갑순이 계정으로 로그인한다 

    + GitHub의 중앙 저장소(ysyun)로 이동하여 "Fork" 버튼을 클릭하면 갑순이 계정으로 중앙 저장소(nulpulum)가 clone된다 

     

     [GitHub Fork 클릭]


  - 갑순이 원격 저장소(nulpulum)를 자신의 PC 로컬 저장소로 clone 한다 : git clone <갑순이 원격저장소>

  - 갑순이의 원격 저장소 이름을 origin에서 myfork로 바꾼다

    + git remote -v : default 설정된 origin 명칭 확인 

    + git rename origin myfork : origin을 myfork라는 이름으로 변경 



2) 갑순이 별도 브랜치 만들고 push 질 하기 

  - 갑순이 별도의 featureA 브랜치를 만들고 두번의 commit 질 한다 

    + git checkout -b featureA : featureA 만들기 

  - 간혹 commit  실수 한것은 날려 버리고 싶다 : git reset --hard HEAD^ (참조)

  - 갑순이의 원격 저장소(nulpulum)인 myfork에 featureA를 push 한다 (참조)

    + GitHub 의 commit 내역은 "Commit" 탭에서 확인가능하다 


  [GitHub Commit]


//////////////////////////////////////////

// 로컬 저장소에 새로운 브랜치 만들기 

dowon /d/git-nulpulum/jmqtt_client (master)

$ git checkout -b featureA

Switched to a new branch 'featureA'


dowon /d/git-nulpulum/jmqtt_client (featureA)

$ vi license.properties


dowon /d/git-nulpulum/jmqtt_client (featureA)

$ git commit -am "modified license 1"

[featureA 9e5ce9b] modified license 1

 1 file changed, 1 insertion(+)


dowon /d/git-nulpulum/jmqtt_client (featureA)

$ vi licene.properties


dowon /d/git-nulpulum/jmqtt_client (featureA)

$ git commit -am "modified license 2"

[featureA b3787b8] modified license 2

 1 file changed, 1 insertion(+), 1 deletion(-)


////////////////////////////////////////////

// 원격 저장소에 새로운 브랜치 만들기 

dowon /d/git-nulpulum/jmqtt_client (featureA)

$ git push myfork featureA

Username for 'https://github.com': nulpulum@gmail.com

Password for 'https://nulpulum@gmail.com@github.com':

Counting objects: 8, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (4/4), done.

Writing objects: 100% (6/6), 562 bytes, done.

Total 6 (delta 2), reused 0 (delta 0)

To https://github.com/nulpulum/jmqtt_client.git

 * [new branch]      featureA -> featureA


  

 [갑순이 GitHub 저장소(nulpulum)의 featureA 브랜치]



3) 갑순이 Pull Request 질 하기 

  - 갑순이는 수정한 사항에 대하여 중앙 저장소(ysyun)의 관리자에게 Pull Request를 요청하여 자신이 수정한 것을 가져가라 알린다

    + 갑순이 GitHub 계정으로 들어가서 상단의 "Pull Request"를 클릭한다 

 

 [갑순이 GitHub 저장소(nulpulum)의 Pull Request 버튼 클릭]


    + Pull Request 원하는 브랜치를 선택한다 

    + 갑순이 원격 저장소(nulpulum)에서 featureA를 선택하고 중앙 저장소(ysyun)에게 Pull Request를 보낸다

    + featureA에 commit 두번 한것과 파일 수정 정보등이 보인다 -Commits (2) Files Chagned (1)-

  [Pull Request 요청 내역 입력한후 "Send pull request" 보내기]



    + 중앙 저장소 (ysyun)에서 Pull Request온 내역을 볼 수 있다 

 [중앙 저장소(ysyun)의 Pull Request 내역 보기]

  


  - 가급적 Pull Request를 할때는 별도의 토픽 브랜치(갑순이가 만든 featureA)와 같이 만들어서 관리자에게 요청한다 

    + master 브랜치와 구분하고 수정 내용을 거부할 때 쉽게 버릴 수 있다

  - 갑순이 다른 브랜치를 만들어서 작업할 때는 featureA에서 하지 말고 origin/master에서 한다 

    + git checkout -b featureB origin/master



<참조> 

  - Pro Git (p. 110)

  - 2개 아이디의 Public repository를 만들어서 테스트 해보았다.

posted by 윤영식
2013. 1. 14. 00:39 Git, GitHub

Remote 저장소인 GitHub과 Local 저장소의 commit 내역이 일치하지 않을 경우 rebase로 어떻게 해결하는지 알아보자. Local 저장소내에서 rebase를 사용하는 것과 약간의 차이점이 존재한다. (참조)


1. Remote 저장소 merge conflict 조건

  - GitHub에 이미 다른 Commit이 존재한다 (분홍색)

  - Local 저장소에 변경된 commit이 존재한다

  - git push 를 수행할 경우 merge conflict가 발생한다

  - 기존에 push후 conflict 발생시 pull 하고 문제 해결하고 다시 push 한다 (해결하기)

  



2. 이제 1)번의 경우 말고 fetch 와 rebase 사용

  - git fetch 를 통하여 local 저장소로 merge 하지 않고 origin/master의 별도 브랜치를 local 저장소로 복사하자 

    


  - git rebase를 수행한다. 이때 다음의 3단계로 진행이 된다. 

    + 브랜칭 된 이후의 master commit 내역을 temporary area로 이동시킨다-origin/master가 아니라- (초록색)

     


    + origin/master를 master 브랜치로 commit 한다. (분홍색)

       


    + temporary area에 있는 master commit 내역을 다시 master로 commit 한다. 

     



3. local과 remote의 같은 파일을 commit 하였을 때 rebase 하는 방법

  - master 브랜치에서 rebase하고 있음에 주의한다 

////////////////////////////////////////////////////////////////////////////

// remote 저장소와 commit 내역을 맞추고 확인해 보자 

$ git log --pretty=oneline

bbeb691d80512e17279764312f60416ebf28dd86 add content in rebase of local repo


// rebase.html 파일의 내용 


////////////////////////////////////////////////////////////////////////////

// 로컬에서도 rebase.html 파일을 변경하고 push를 시도하지만 reject 된다.

// 즉, remote 저장소의 rebase.html과 local 저장소의 rebase.html 내역이 틀리다.

$ git push

Username for 'https://github.com':

Password for 'https://ysyun@yuwin.co.kr@github.com':

To https://github.com/ysyun/pro_git.git

 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to 'https://github.com/ysyun/pro_git.git'

hint: Updates were rejected because a pushed branch tip is behind its remote

hint: counterpart. If you did not intend to push that branch, you may want to

hint: specify branches to push or set the 'push.default' configuration

hint: variable to 'current' or 'upstream' to push only the current branch.


////////////////////////////////////////////////////////////////////////////

// origin/master를 local 저장소로 가지고 온다. 

$ git fetch

remote: Counting objects: 5, done.

remote: Compressing objects: 100% (3/3), done.

remote: Total 3 (delta 1), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

From https://github.com/ysyun/pro_git

   d895a7e..9274820  master     -> origin/master


////////////////////////////////////////////////////////////////////////////

// rebase를 위하여 master로 이동한다 

$ git branch

* (no branch)

  master


$ git checkout master

Warning: you are leaving 1 commit behind, not connected to

any of your branches:


  bbeb691 add content in rebase of local repo


If you want to keep them by creating a new branch, this may be a good time

to do so with:


 git branch new_branch_name bbeb691d80512e17279764312f60416ebf28dd86


Switched to branch 'master'

Your branch and 'origin/master' have diverged,

and have 1 and 3 different commits each, respectively.


$ git  branch

* master


////////////////////////////////////////////////////////////////////////////

// rebase를 수행한다. 

// rebase.html 파일 내역에서 conflict가 나온다고 메시지를 출력한다 

$ git rebase

First, rewinding head to replay your work on top of it...

Applying: updating rebase in local repo.

Using index info to reconstruct a base tree...

M       rebase.html

Falling back to patching base and 3-way merge...

Auto-merging rebase.html

CONFLICT (content): Merge conflict in rebase.html

Failed to merge in the changes.

Patch failed at 0001 updating rebase in local repo.


When you have resolved this problem run "git rebase --continue".

If you would prefer to skip this patch, instead run "git rebase --skip".

To check out the original branch and stop rebasing run "git rebase --abort".


$ git status

# Not currently on any branch.

# Unmerged paths:

#   (use "git reset HEAD <file>..." to unstage)

#   (use "git add/rm <file>..." as appropriate to mark resolution)

#

#       both modified:      rebase.html

#

no changes added to commit (use "git add" and/or "git commit -a")


////////////////////////////////////////////////////////////////////////////

// rebase.html 파일 내역을 보고 적절히 수정한다 

$ cat rebase.html

 this is rebase html file ok

<<<<<<< HEAD

     updating rebase in remote repo. again

     add content in remote repo.

=======

    updating rebase in local repo.

>>>>>>> updating rebase in local repo.


$ vi rebase.html

$ cat rebase.html

 this is rebase html file ok

     updating rebase in remote repo. again

     add content in remote repo.

    updating rebase in local repo.


////////////////////////////////////////////////////////////////////////////

// rebase.html 을 staging area로 add 한다. 

$ git add rebase.html


////////////////////////////////////////////////////////////////////////////

// rebase를 계속 진행한다 

$ git rebase --continue

Applying: updating rebase in local repo.


////////////////////////////////////////////////////////////////////////////

// commit log를 확인해 보면 rebase가 되어서 remote commit 내역이 local 저장소에 

// 복사되었다. 

$ git log --pretty=oneline

30d42e6785e441c3b515a4f4181dbfa051ad400a updating rebase in local repo.

9274820a9f62b2e08411ffb34d808508c7a74f93 add content in rebase of remote repo

d895a7e83d85d05f2c81585232f9c3e22426383a updating rebase again in remote repo

8c7c04b40d9fce0a1ae5a52b45b438fa14ea95e1 Update rebase.html


////////////////////////////////////////////////////////////////////////////

// 다시 push를 하면 정상적으로 remote 저장소로 push 가 된다 

$ git push

Username for 'https://github.com':

Password for 'https://ysyun@yuwin.co.kr@github.com':

Counting objects: 5, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (3/3), 323 bytes, done.

Total 3 (delta 2), reused 0 (delta 0)

To https://github.com/ysyun/pro_git.git

   9274820..30d42e6  master -> master


// remote에 local에서 직접 수정한 내역이 commit 됨 


// local repo(파란색, 30d42e6785)의 SHA 값이 가장 상위에 그 다음 remote repo 의 SHA(927480a9f...)가 밑에 있다. 


posted by 윤영식
2013. 1. 13. 21:14 Git, GitHub

원격저장소로 GitHub을 이용하고 있고, Branch를 만들고 삭제하는 방법에 대해서 알아보자. 


1) 브랜치 생성, 삭제 순서 

  - local 저장소에 branch를 만든다 

  - remote 저장소로 branch를 push 하여 추적(tracking) 한다 

  - 사용하지 않는 branch는 삭제한다 

////////////////////////////////////////////////

// 새로운 브랜치를 생성하고 checkout 한다 

$ git checkout -b shopping_cart

Switched to a new branch 'shopping_cart'


////////////////////////////////////////////////

// 원격 저장소로 브랜치를 push 한다 

$ git push origin shopping_cart

Username for 'https://github.com':

Password for 'https://ysyun@yuwin.co.kr@github.com':

Total 0 (delta 0), reused 0 (delta 0)

To https://github.com/ysyun/pro_git.git

 * [new branch]      shopping_cart -> shopping_cart


// github에 새로운 브랜치가 추가 되었다. 


///////////////////////////////////////////////

// 새로운 파일을 추가하고 원격으로 push 한다 

$ touch cart.js

$ git add cart.js

$ git commit -m "add cart javascript file"

[shopping_cart 4856f8d] add cart javascript file

 0 files changed

 create mode 100644 cart.js


$ git push

Username for 'https://github.com':

Password for 'https://ysyun@yuwin.co.kr@github.com':

Counting objects: 3, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (2/2), 245 bytes, done.

Total 2 (delta 1), reused 0 (delta 0)

To https://github.com/ysyun/pro_git.git

   f42a865..4856f8d  shopping_cart -> shopping_cart


///////////////////////////////////////////////

// 로컬 브랜치 내역 과 원격 브랜치 내역을 본다 

$ git branch

  master

* shopping_cart


$ git branch -r

  origin/HEAD -> origin/master

  origin/master

  origin/shopping_cart


////////////////////////////////////////////////////

// 로컬의 새로 추가한 shopping_cart 브랜치를 삭제한다

$ git checkout master

Switched to branch 'master'


$ git branch -d shopping_cart

error: The branch 'shopping_cart' is not fully merged.

If you are sure you want to delete it, run 'git branch -D shopping_cart'.


$ git branch -D shopping_cart

Deleted branch shopping_cart (was 4856f8d).


$ git branch

* master


///////////////////////////////////////////////

// 로컬에 이제 shopping_cart 브랜치가 없다 다시 복구 하고 싶다면

// 원격 저장소를 통하여 checkout 하면 된다 

$ git checkout shopping_cart

Branch shopping_cart set up to track remote branch shopping_cart from origin.

Switched to a new branch 'shopping_cart'


$ git branch

  master

* shopping_cart


///////////////////////////////////////////////

// 원격의 브랜치 내역을 보자

// 어떤 브랜치들이 존재하는지 한눈에 알 수 있다 

$ git remote show origin

* remote origin

  Fetch URL: https://github.com/ysyun/pro_git.git

  Push  URL: https://github.com/ysyun/pro_git.git

  HEAD branch: master

  Remote branches:

    master        tracked

    shopping_cart tracked

  Local branches configured for 'git pull':

    master        merges with remote master

    shopping_cart merges with remote shopping_cart

  Local refs configured for 'git push':

    master        pushes to master        (up to date)

    shopping_cart pushes to shopping_cart (up to date)


///////////////////////////////////////////////

// 원격에 있는 브랜치를 삭제 하자 

$ git push origin :shopping_cart

Username for 'https://github.com':

Password for 'https://ysyun@yuwin.co.kr@github.com':

To https://github.com/ysyun/pro_git.git

 - [deleted]         shopping_cart


// shopping_cart 브랜치가 삭제되었음을 알 수 있다

$ git remote show origin

* remote origin

  Fetch URL: https://github.com/ysyun/pro_git.git

  Push  URL: https://github.com/ysyun/pro_git.git

  HEAD branch: master

  Remote branch:

    master tracked

  Local branch configured for 'git pull':

    master merges with remote master

  Local ref configured for 'git push':

    master pushes to master (up to date)


///////////////////////////////////////////////

// remote 브랜치 clean up 하기 

$ git remote prune origin


UserXP@NUKNALEA /d/Git_repositories/pro_git (master)

$ git remote show origin

* remote origin

  Fetch URL: https://github.com/ysyun/pro_git.git

  Push  URL: https://github.com/ysyun/pro_git.git

  HEAD branch: master

  Remote branch:

    master tracked

  Local branch configured for 'git pull':

    master merges with remote master

  Local ref configured for 'git push':

    master pushes to master (up to date)


2) master가 아닌 local 브랜치를 remote 저장소의 master 브랜치에 push 하기 

  - 조건 : local 저장소의 브랜치가 master가 아닌 다른 브랜치로 checkout 되어 있을 경우 예) shopping_cart

  - 명령 :  git push [원격저장소 주소 alias] [로컬저장소명칭]:master

  - 예 : git push origin shopping_cart:master

  - 의미 : origin 원격 주소의 master 브랜치에 local저장소의 shopping_cart 브랜치를 push 한다


posted by 윤영식
2012. 10. 25. 17:48 Git, GitHub/GitHub

GitHub의 Wiki는 단순 페이지만을 생성하는데, 일반 위키들 처럼 오른쪽에 목차가(Sidebar) 나오고 하단에는 footer등을 넣고 싶을 경우 다음을 참조하자 



내 프로젝트에서도 한번 써봐야 겠다. 그동안 wiki 페이지 기능이 단순해서 사용하지 않았는데, 확장을 할 수 있게 되어 있었다. 

  • OSS인 골룸(gollum)을 통해서 GitHub의 wiki를 확장할 수 있다
  • Sidebar 넣기 
    • _Sidebar.ext 파일을 만든다. 물론 내용은 wiki 형식을 따르면 된다 : .md파일이 없는 모든 sub directory에 영향을 미친다 (요건 체크해 볼일이다)
    • wiki git을 checkout 한다 (wiki의 Git Access 탭에서 git url을 얻으면 됨)
    • wiki repository를 local로 다 가져온후 _Sidebar.md 파일을 만든다
    • .md 파일안에 markdown syntax로 link를 [[link]] 형식으로 넣는다 
    • _Sidebar.md 파일을 commint한후 origin master에 push 한다 
  • Header 넣기
    • _Header.ext 파일 만든다 (wiki 포멧)
    • _Header.md 파일 만든다 (markdown syntax)
  • Footer 넣기
    • _Footer.ext 파일 만든다 (wiki 포멧)
    • _Footer.md 파일 만든다 (markdown syntax)  


요점만 정리했는데, 실제로 해볼일~~에구구

posted by 윤영식
prev 1 next