svn만 쓰다가 git을 쓰려고 하는데 자주 안쓰니 자꾸 까먹는다.

다음 사이트를 가보니 아주 명쾌하다.


https://rogerdudler.github.io/git-guide/index.ko.html


일부 내용을 요약하자면


새로운 리파지토리를 만들려면


git init


현재 작업 내용을 추가 후 커밋하려면


git add *

git commit -m "메시지"


변경 내용을 원격 서버에 저장하려면, 먼저 원격 서버를 등록한다음 push


git remote add origin 원격서버주소

git push origin master


디렉토리 일부는 git 관리 대상에서 제외하려면 .gitignore에 디렉토리명 등록 및 삭제, 커밋, push


.gitignore에 해당 디렉토리 추가

git rm -r 디렉토리명

git commit -m "디렉토리 삭제"

git push origin master


커밋 로그 보기


git log


커밋 로그 가독성 있게 커스터마이즈하기


git log --pretty=format:"%cd - %an, %ar : %s"


커스터마이즈한 커맨드 alias로 등록하기


git config --global alias.clog 'log --pretty=format:"%cd - %an, %ar : %s"'


커밋 수정하기


git commit --amend


리모트 저장소의 업데이트 내용 자동으로 머지하기


git pull



파일을 원상태로 복구하기


git checkout -- <file>



git status로 한글이 escape처리되어 읽을 수 없는 경우 


git config --global core.quotepath false



참고정보

  • svn / git 비교표 : http://gmatcentral.org/display/GW/SVN+and+Git+Command+Mappings




Windows

  • Right Mouse Button + Shift
  • OR: Middle Mouse Button
  • Add to selection: Ctrl
  • Subtract from selection: Alt


참고링크: https://www.sublimetext.com/docs/2/column_selection.html


모든 메뉴는 핫키로 등록하여 쓸 수 있다.

File Search는 기본적으로 핫키 등록이 안되어 있는데 아래와 같이 구성하여 핫키로 사용하고 있다.





참고

http://stackoverflow.com/questions/91984/how-do-i-hotkey-directly-to-file-search-tab-in-eclipse



인코딩이 문제일 수 있다.

eclipse.ini에 다음 라인을 추가한다.


-Dfile.encoding=UTF8



파일 저장 후에 이클립스를 재시작하면 잘 나온다.


sbtplugin


/project 디렉토리에 assembly.sbt 넣기


$ more assembly.sbt

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.1")


$ more build.sbt
name := "MySampleJar"

version := "1.0"

scalaVersion := "2.10.1"

libraryDependencies ++= Seq (
        "org.apache.spark" %% "spark-core" % "1.6.0" % "provided",
        "org.apache.spark" %% "spark-sql" % "1.6.0" % "provided"
)

jarName in assembly := "my-sample.jar"

// Scala 라이브러리를 제외하고 싶은 경우 추가
assemblyOption in assembly :=
        (assemblyOption in assembly).value.copy(includeScala = false)


다음 커맨드를 실행하면 모든 파일이 묶여서 하나의 jar로 만들어진다.
$ sbt assembly

참고: https://github.com/sbt/sbt-assembly



테스트를 건너띄고 합치고 싶은 경우는 다음과 같이 하면 된다.


sbt "set test in assembly := {}" clean assembly


참고: http://stackoverflow.com/questions/26499444/how-run-sbt-assembly-command-without-tests-from-command-line


.scala 파일 맨 앞줄에 shebang을 넣어준다.


  1 #!/usr/bin/env scala

  2

  3 println("hello")


파일 속성을 변경해준다.


$ chmod a+x test.scala


이제 바로 실행이 된다.


$ ./test.scala

hello



$ sbt 'inspect sbtVersion'

[info] Set current project to gilbird (in build file:/C:/cygwin64/home/gilbird/)

[info] Setting: java.lang.String = 0.13.9

[info] Description:

[info]  Provides the version of sbt.  This setting should be not be modified.

[info] Provided by:

[info]  */*:sbtVersion

[info] Defined at:

[info]  (sbt.Defaults) Defaults.scala:135

[info] Delegates:

[info]  *:sbtVersion

[info]  {.}/*:sbtVersion

[info]  */*:sbtVersion

[info] Related:

[info]  */*:sbtVersion




$ sbt sbt-version

[info] Set current project to root--sbt (in build file:/C:/cygwin64/home/gilbird/.sbt/)

[info] 0.13.9


log4j 컬러로 출력하기

http://stackoverflow.com/questions/7848325/making-a-log4j-console-appender-use-different-colors-for-different-threads


이클립스 ANSI 콘솔

https://marketplace.eclipse.org/content/ansi-escape-console

+ Recent posts