WOONO's Blog





git command

2019. 1. 2. 12:51 : Windows7/Tip

Command line instructions 

 

˙ Git global setup 

 

git config --global user.name "Jin-Hee, Lee" 

git config --global user.email "selfix1123@gmail.com" 

 

˙ Create a new repository 

 

cd test 

touch README.md 

git add README.md 

git commit -m "add README" 

git push -u origin master 

 

˙ Existing folder 

 

cd existing_folder 

git init 

git remote add origin https://gitlab.com/citus_kt/sandbox.git 

git add . 

git commit -m "Initial commit" 

git push -u origin master 

 

˙ Existing Git repository 

 

cd existing_repo 

git remote rename origin old-origin 

git remote add origin https://gitlab.com/citus_kt/sandbox.git 

git push -u origin --all 

git push -u origin --tags 

 

˙ rebase 

$ git reset --hard HEAD~ 

$ git branch -i XXXX 

git checkout issue3 

 

########################################################################################  

  

git config 파일에 저장  

  

########################################################################################  

  

#git config ollehlog : git olog  

  

git config --global alias.olog "log --decorate --pretty=format:'%C(bold red)* gitlab%C(reset) : https://gitlab.com/citus_kt/ollehnavi/commit/%h%n%C(bold blue)* title  : %s%C(reset) : %C(bold cyan)%ai%C(reset)%n%C(bold yellow)* author : [%an]-<%ce>%C(reset)%n%n' --abbrev-commit --date=relative 

  

  

  

#git config enginelog : git elog  

  

git config --global alias.elog "log --decorate --pretty=format:'%C(bold red)* gitlab%C(reset) : https://gitlab.com/citus_kt/engine/commit/%h%n%C(bold blue)* title  : %s%C(reset) : %C(bold cyan)%ai%C(reset)%n%C(bold yellow)* author : [%an]-<%ce>%C(reset)%n%n' --abbrev-commit --date=relative 

  

  

  

#commit config daudiolog : git dlog  

  

git config --global alias.dlog "log --decorate --pretty=format:'%C(bold red)* gitlab%C(reset) : https://gitlab.com/citus_kt/daudio/commit/%h%n%C(bold blue)* title  : %s%C(reset) : %C(bold cyan)%ai%C(reset)%n%C(bold yellow)* author : [%an]-<%ce>%C(reset)%n%n' --abbrev-commit --date=relative 

  

  

  

########################################################################################  

 

 

˙ git log all shell script 

 

gitalog 

 

#!/bin/bash 

 

git log --decorate --pretty=format:'%C(bold red)* hash   : %H%C(reset)%n%C(bold green)* gitlab : https://gitlab.com/citus_kt/'${PWD##*/}'/commit/%h%C(reset)%n%C(bold cyan)* date   : %C(bold blue)%ai%C(reset)%n%C(bold yellow)* author : %an <%ce>%C(reset)%n%C(bold white)* title  : %B%C(reset)%n%n' --abbrev-commit --date=relative 

 

  

git log 출력  

  

########################################################################################  

  

#git log ollehlog : git olog  

  

  

  

git log --decorate --pretty=format:'%C(bold red)* gitlab%C(reset) : https://gitlab.com/citus_kt/ollehnavi/commit/%h%n%C(bold blue)* title  : %s%C(reset) : %C(bold cyan)%ai%C(reset)%n%C(bold yellow)* author : [%an]-<%ce>%C(reset)%n%n 

  

  

  

#commit config enginelog : git elog  

  

  

  

git log --decorate --pretty=format:'%C(bold red)* gitlab%C(reset) : https://gitlab.com/citus_kt/engine/commit/%h%n%C(bold blue)* title  : %s%C(reset) : %C(bold cyan)%ai%C(reset)%n%C(bold yellow)* author : [%an]-<%ce>%C(reset)%n%n 

  

  

  

#commit config daudiolog : git dlog  

  

  

  

git log --decorate --pretty=format:'%C(bold red)* gitlab%C(reset) : https://gitlab.com/citus_kt/daudio/commit/%h%n%C(bold blue)* title  : %s%C(reset) : %C(bold cyan)%ai%C(reset)%n%C(bold yellow)* author : [%an]-<%ce>%C(reset)%n%n 

  

   

  

########################################################################################  

  

git log graphic   

  

########################################################################################  

  

git config --global alias.logall "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative 

 

 

˙ git fetch 

 

git fetch --progress --prune 

 


˙ git branch create 

 

git branch name 

 

git branch delete 

 

git branch -D feature-01 

 

git 연동 

 

git branch --set-upstream-to origin/feature-01 

 

 

˙ git checkout and create local branch 


git checkout -t origin/eventsource 

 

 

˙ git diff and log author

 

git diff -L 10,100:xxx.java 



Posted by woono