'2017/10/24'에 해당되는 글 2건

  1. 2017.10.24 [git] 여러 commit을 하나로 병합하기
  2. 2017.10.24 geminabox 설치/실행


3개의 커밋을 하나로 합쳐본다.



$ git log --pretty=oneline

aae3f8afa5c7e97d8974525994f100b93258baf3 commit 3

2c24df186d7b779a87882e0968503fb019866d62 commit 2

ae08eead7cf187b85fd73d5a2ceb3f0a256c99b1 commit 1


3번 commit/push했고 이를 하나의 commit 메시지로 만들고 싶을 때 사용할 수 있는 git 커맨드를 소개한다. 



최신 3개의 commit을 rebase로 하나로 합쳐 본다. -i는 대화형 모드를 의미한다. 


$ git rebase -i HEAD~3

  

pick ae08eea commit 1

pick 2c24df1 commit 2

pick aae3f8a commit 3


# Rebase acf9816..aae3f8a onto acf9816 (3 command(s))

#

# Commands:

# p, pick = use commit

# r, reword = use commit, but edit the commit message

# e, edit = use commit, but stop for amending

# s, squash = use commit, but meld into previous commit

# f, fixup = like "squash", but discard this commit's log message

# x, exec = run command (the rest of the line) using shell

# d, drop = remove commit

#




아래와 같이 수정한다. 

commit 1은 그대로. commit 2와 commit 3의 pick을 squash또는 s로 변경한다. 


pick ae08eea commit 1

squash 2c24df1 commit 2

squash aae3f8a commit 3


# Rebase acf9816..aae3f8a onto acf9816 (3 command(s))

#

# Commands:

# p, pick = use commit

# r, reword = use commit, but edit the commit message

# e, edit = use commit, but stop for amending

# s, squash = use commit, but meld into previous commit

# f, fixup = like "squash", but discard this commit's log message

# x, exec = run command (the rest of the line) using shell

# d, drop = remove commit

#


저장하고 종료하면 squash 화면이 나타난다. 

여기에서 commit1 앞에 REDIS-1을 추가해본다. 


다음 화면이 나타나고 쉘로 나온다. 



 3 files changed, 0 insertions(+), 0 deletions(-)

 create mode 100644 1

 create mode 100644 2

 create mode 100644 3

Successfully rebased and updated refs/heads/master.



3개의 commit이 하나의 commit으로 나타난다. 


$ git log --pretty=oneline

7dca124e20dea4a4248be52eae50081580ac329d REDIS-1 commit 1

acf9816e316d960df3a99c6bb9c0ee40ac31dee0 Initial commit



해당 commit을 확인해보면 commit 1, commit 2, commit 3 모두 존재한다.


$ git log -p 1

commit 7dca124e20dea4a4248be52eae50081580ac329d

Author: knight76@gmail.com

Date:   Tue Oct 24 19:27:43 2017 +0900


    REDIS-1 commit 1


    commit 2


    commit 3


diff --git a/1 b/1

new file mode 100644

index 0000000..e69de29




이미 remote repository에 저장했기 때문에 git push --force를 실행해서 서버에도 반영한다.






만약, push를 하지 않은 상태라면 git reset --soft HEAD~3 커맨드를 사용하면 된다. 



$ git log --pretty=oneline

13a9d0da6ebf8f0ab2d78761cd26bad3136c5cec commit 3

628a2b89c35e134aeccd0e26dc90dc78575f2493 commit 2

e8630d725e97f8f11e8036d303abe4812f956dea commit 1

acf9816e316d960df3a99c6bb9c0ee40ac31dee0 Initial commit


$ git reset --soft HEAD~3


$ git status

On branch master

Your branch is up-to-date with 'origin/master'.

Changes to be committed:

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


new file:   1

new file:   2

new file:   3


$ git log --pretty=oneline

acf9816e316d960df3a99c6bb9c0ee40ac31dee0 Initial commit


$ git add .

$ git commit -m 'REDIS-1 commit 1'

[master a3eaa44] REDIS-1 commit 1

 3 files changed, 0 insertions(+), 0 deletions(-)

 create mode 100644 1

 create mode 100644 2

 create mode 100644 3

$ git push


Posted by '김용환'
,

geminabox 설치/실행

Ruby 2017. 10. 24. 09:56



https://github.com/geminabox/geminabox






geminabox는 사내(inhouse)에서 custom plugin을 설치하는데 도움을 준다.


설치(최신 geminabox는 루비 2.2.2가 필요하다)


$ sudo gem install geminabox




config.ru 파일을 생성한다. 데이터 저장위치도 잘 선택한다.


require "rubygems"

require "geminabox"

Geminabox.data = "/home/www/geminabox/gems"

run Geminabox::Server




geminabox 데몬을 시작하는 스크립트이다. rackup을 사용한다. -p는 포트이고, -E는 개발환경을 의미한다. -E production을 주지 않으면 로컬에서만 확인할 수 있다. -D는 데몬으로 동작하도록 알린다.


rackup -p 3000 -E production -D



데몬을 중지하려면 다음을 실행한다.



PID=`ps -ef | grep 'rackup' | grep -v grep | awk '{print $2}'`

if [ -z $PID ]; then

  echo "no process"

else 

  kill -9 $PID

  echo "killed .. done"

fi



'Ruby' 카테고리의 다른 글

gem 설치 디버깅하기  (0) 2017.10.20
ruby zookeeper  (0) 2017.02.07
[ruby] http call 예시  (0) 2017.01.06
[capistrano] 다른 task 호출하기  (0) 2016.12.07
ruby on rails 애플리케이션 실행하기  (0) 2016.10.12
Posted by '김용환'
,