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 '김용환'
,

[git] git reset hard

etc tools 2017. 9. 1. 19:15


잘못 commit을 했지만 git 서버의 커밋된 버전을 이동하려면 다음과 같은 명령을 사용할 수 있다. 


먼저 로그 내용과 short hash 내용을 얻는다. 


$ git log --pretty=oneline --abbrev-commit

ab2cb94 XXFactoryBean 생성

12312414 ...




특정 commit으로 이동하려면 다음과 같이 사용할 수 있다.


git reset --hard ab2cb94




뒤 커밋으로 하나 이동하려면 다음 커맨드를 사용한다.


git reset --hard HEAD



3번째 뒤 커밋으로 이동하려면 다음 커맨드를 사용한다.


git reset --hard HEAD~3


git reset --hard HEAD^^^





Posted by '김용환'
,


크롬에서 자동 리프레시가 되게 해주는 gulp livereload를 설치할 수 있다 

ctrl + f 누르지 않고도 데이터가 수정되자마자 사용자가 바로 바뀌어진 문서를 보게 할 수 있다. 





gulp 설치


$ npm install --save-dev gulp gulp-watch gulp-livereload

$ npm link gulp



gulpfile.js 파일


$ vi  gulpfile.js


var gulp = require('gulp');

var pug = require('gulp-pug');

var less = require('gulp-less');

var minifyCSS = require('gulp-csso');


gulp.task('html', function(){

  return gulp.src('client/templates/*.pug')

    .pipe(pug())

    .pipe(gulp.dest('build/html'))

});


gulp.task('css', function(){

  return gulp.src('client/templates/*.less')

    .pipe(less())

    .pipe(minifyCSS())

    .pipe(gulp.dest('build/css'))

});


gulp.task('default', [ 'html', 'css' ]);



gulp를 실행한다. 


$ gulp watch


[20:15:03] Using gulpfile ... gulpfile.js

[20:15:03] Starting 'watch'...



크롬에서는 livereload 플러그인을 실행한다. 



완료!




참고 : http://hochulshin.com/gulp-livereload-sample/

'etc tools' 카테고리의 다른 글

[git] 여러 commit을 하나로 병합하기  (0) 2017.10.24
[git] git reset hard  (0) 2017.09.01
[github] PR(pull request) 하기  (0) 2017.08.17
github page 웹으로 생성하기  (0) 2017.08.17
[influxdb] influxdb clustering은 무료 버전?  (0) 2017.03.23
Posted by '김용환'
,



* master 브랜치 기반의 PR(pull request) 



먼저 github 원격 저장소를 내 저장소로 fork한다. 


내 github 저장소를 origin, 원격 githubub 저장소를 real이라고 지정한다. 




# git clone https://github.com/samuel-kim/optools.git


# git remote add real https://github.com/cassandra/optools.git


# git remote -v


origin https://github.com/samuel-kim/optools.git (fetch)

origin https://github.com/samuel-kim/optools.git (push)

real https://github.com/cassandra/optools.git (fetch)

real https://github.com/cassandra/optools.git (push)




내 저장소의 master 브랜치를 기반으로 새로운 브랜치를 만든다. 


git checkout -b fix_errata


코드 수정하고 푸시한다. 


git add .

git commit -m 'fix errata'

git push origin




원격 github 웹 페이지에 접속하면 "Compare & pull reqeust"이 보인다.

어느 브랜치에 PR할지 결정한다. 


PR이 완료되면, master 브랜치로 이동한다.


git checkout master


기존 브랜치를 삭제한다. 


git branch -d fix_errata


리모트 브랜치를 삭제한다. 


git push origin --delete fix_errata



real의 master를 origin의 master에 merge한다. 즉 원격 github 저장소의 master에 머징된 내용(새로워짐)을 내 저장소의 master(구버전)로 병합한다. 


현재 origin master로 되어 있다. origin master(내꺼)를 기준으로 원본 real의 master(기준)의 내용을 rebase한다. 


$ git branch -l

* master


$ git rebase real/master



origin master에 push한다. 


git push origin origin/master





이미 origin 저장소의 브랜치로 checkout된 상태에서 

저 멀리 real 은 코드 푸시가 다량으로 일어날  있고, 시간이 지나면서 내 저장소인 origin과의 소스 커밋 차이가 발생한다.


그 때는 브랜치에서 다음 커맨드를 실행해 브랜치 상황을 살펴 본다.


git pull real



만약 master만 real 브랜치의 새로운 버전으로 다운받고 싶다면 다음 커맨드를 실행한다.


git pull real master


그리고 push하면 동일하게 맞춰진다. 


git push 





Posted by '김용환'
,




https://jekyllrb-ko.github.io/ 를 참고..



먼저 jekull을 설치한다.



git clone ...

cd ...

gem install jekyll

jekyll serve --host 0.0.0.0


index.md 페이지는 http://localhost:4000/index으로 접근할 수 있다.

op.md 페이지는 http://localhost:4000/op로 접근할 수 있다. 






Posted by '김용환'
,



influxdb의 clustering은 무료 버전은 0.10 정도까지만 지원한다. 


현재 2017년 3월에는 상용 버전만 지원한다. 


https://docs.influxdata.com/influxdb/v1.2/high_availability/clusters/


Open-source InfluxDB does not support clustering. For high availability or horizontal scaling of InfluxDB, please investigate our commercial clustered offering, InfluxEnterprise.

'etc tools' 카테고리의 다른 글

[github] PR(pull request) 하기  (0) 2017.08.17
github page 웹으로 생성하기  (0) 2017.08.17
[git] git 저장소 변경하기  (0) 2017.03.16
[git] git log 범위  (0) 2016.08.24
[git] git hash 얻기  (0) 2016.08.24
Posted by '김용환'
,



현재 git 저장소를 확인한다.


$ git remote -v



새로운 저장소로 변경한다.


$ git remote set-url origin https://github.com/xxx/aaa-project.git


확인을 위해서 다음 커맨드를 실행해 본다.

$ git pull


'etc tools' 카테고리의 다른 글

github page 웹으로 생성하기  (0) 2017.08.17
[influxdb] influxdb clustering은 무료 버전?  (0) 2017.03.23
[git] git log 범위  (0) 2016.08.24
[git] git hash 얻기  (0) 2016.08.24
artifactory 설치하기  (0) 2016.01.30
Posted by '김용환'
,

[git] git log 범위

etc tools 2016. 8. 24. 16:52



특정 git hash를 얻어와서, 지금까지의 history를 한 번에 보고 싶다면 git log 와 ..를 활용할 수 있다. 


git log #{from}..#{to} 이런 느낌으로 실행하면 된다.


git log ${git_hash}..HEAD


'etc tools' 카테고리의 다른 글

[influxdb] influxdb clustering은 무료 버전?  (0) 2017.03.23
[git] git 저장소 변경하기  (0) 2017.03.16
[git] git hash 얻기  (0) 2016.08.24
artifactory 설치하기  (0) 2016.01.30
[gradle] provided compile  (0) 2015.11.30
Posted by '김용환'
,

[git] git hash 얻기

etc tools 2016. 8. 24. 16:16


git hash를 얻는 부분이다. 


 yte

길게 보려면 rev-parse를 쓸 수 있다.


$ git rev-parse master

0effa0fcc670fc999ee979e95be931decba13114



긴 hash라서 짧은 hash를 이용하려면 아래와 같이 사용할 수 있다. 1byte째부터 7byte까지가 short hash이다. 



$ git rev-parse --short master

0effa0f



$ git log -1 --pretty=format:%h

0effa0f



$ git describe --always

0effa0f

'etc tools' 카테고리의 다른 글

[git] git 저장소 변경하기  (0) 2017.03.16
[git] git log 범위  (0) 2016.08.24
artifactory 설치하기  (0) 2016.01.30
[gradle] provided compile  (0) 2015.11.30
gradle 2.9 - 50% 줄어든 컴파일 속도  (0) 2015.11.26
Posted by '김용환'
,

artifactory 설치하기

etc tools 2016. 1. 30. 08:54



nexus는 버전 이슈가 많고 발전이 더딘 것 같다. (특히 자바와 최신 nexus 버전 이슈가 좀 있는 것 같다.) 문서도 예전 버전이고, 신선함이 사라져가는 느낌이다. 


artifactory의 큰 장점은 편리하고 개선되는 UI, HA, docker, webdav, rest api, 다양한 설치본(jar 뿐 아니라. npm, docker..)에 대한 proxy 기능, 완전 좋은 문서화이다. 생전 처음 artifactory 써봤는데, 아주 만족스럽다. (gradle 프로젝트하면서 지원하는 프로젝트가 jcenter쪽 repostiory가 jfrog였는데. 지원 벤더가 jfrog였는데, artifactory도 jfrog가 지원한다.)

더 좋은 기능을 돈을 줘야 하지만, 무료 기능만으로 괜찮은 것 같다.

artifactory 4.2.2 기준이다.

artifactory 설치시 꼭 문서를 참조하는 좋다.


1) 설치

java 설치

artifactory 4.4 설치  (최소 java8 이상)

(docker로 쓸 수 있지만, 굳이..)


2) 설정

https://www.jfrog.com/confluence/display/RTF/System+Requirements

JAVA_HOME JRE_HOME 설정하기


$ARTIFACTORY_HOME/bin/artifactory.default의 memory 설정을 변경

-server -Xms10g -Xmx10g -Xss512k -XX:+UseG1GC


3) 서버 실행

$ARTIFACTORY_HOME/bin/artifactory.sh 으로 실행하면 foreground로 실행된다.

$ARTIFACTORY_HOME/bin/artifactoryctl start 또는 $ARTIFACTORY_HOME/bin/artifactory.sh start로 실행한다.


4) 웹 서버 확인

http://localhost:8081/artifactory/

문제시 logs 밑에 로그를 확인한다.


5) 보안 강화

https://www.jfrog.com/confluence/display/RTF/Configuring+Security

admin/password 디폴트 패스워드에서 admin메뉴의 security에 들어가 패스워드 변경


6)  virtual 묶음

https://www.jfrog.com/confluence/display/RTF/Virtual+Repositories

내부 repository와 & 외부 repository 묶어서 maven, gradle, sbt 파일에서 repository는 새로 설치된 서버만 바라보게 설정.


7) nginx 설정

https://www.jfrog.com/confluence/display/RTF/nginx 

server {
    listen *:80 ;
    server_name artifactory.yourdomain.com;
    client_max_body_size 2048M;
    access_log /var/log/nginx/artifactory.yourdomain.com.access.log;
  
    location /artifactory {
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://localhost:8081;
        proxy_pass_header Server;
        proxy_read_timeout 90;
    }
}


제일 중요한 것은 client_max_body_size이다. 이거 안 쓰거나 너무 작은 크기이면, 413 에러 발생한다.

http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/


8) 로컬에서 확인

pom.xml에 repository 추가/변경 후 rm -f ~/.m2/ 후, mvn clean compile 로 확인


9) deploy 계정 확인

mvn deploy시 jar 업로드 할 때, 권한 관리를 한다.

anonymous하게 jar deploy되게 하려면, 따로 설정해야 한다. 그렇지 않으면 401 에러가 발생한다.

만약 권한 없이 deploy되게 하려면, security->users 메뉴에서 anonymous에 deploy/cache 기능에 checkbox되도록 수정한다. (edit anonymous user)


만약 권한 설정하려면 아래와 같이 진행한다.

http://jeroenmols.com/blog/2015/08/13/artifactory2/


10) deploy 확인

mvn deploy이 잘되는지 확인한다.

 

용량 관리 및 GC설정

https://www.jfrog.com/confluence/display/RTF/Managing+Disk+Space+Usage


주기적인 백업

https://www.jfrog.com/confluence/display/RTF/Managing+Backups


빠른 읽기

https://www.jfrog.com/confluence/display/RTF/Remote+Repositories

Eagerly Fetch Sources, Eagerly Fetch Jars

관련 lib를 백그라운드로 받도록 설정한다.




play1은 iBiblio를 사용한다. (virtual repo를 사용할 수도 있다.)

type: iBiblio

root: "http://artifactory.google.com:8081/artifactory/google-repo".

https://www.playframework.com/documentation/1.2.x/dependency

https://www.jfrog.com/confluence/display/RTF/Working+with+Ivy#WorkingwithIvy-TheIBiblioResolver


'etc tools' 카테고리의 다른 글

[git] git log 범위  (0) 2016.08.24
[git] git hash 얻기  (0) 2016.08.24
[gradle] provided compile  (0) 2015.11.30
gradle 2.9 - 50% 줄어든 컴파일 속도  (0) 2015.11.26
[git] Github의 ssh key 이슈  (0) 2015.11.04
Posted by '김용환'
,