You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Only this session
PS1="\[\033[32m\]\h \[\033[34;1m\]\w \[\033[32m\]\[\033[m\]\[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "
# Make alias
alias ps1g='PS1="\[\033[32m\]\h \[\033[34;1m\]\w \[\033[32m\]\[\033[m\]\[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "'
# → jMac2 ~/test (master)$
mkdir src
cp xx src/
cd src
git init
git add .
git commit -m "Initial commit"
git log
Commit Only Change
echo "This is a change" > test01
git diff
# 변경사항 커밋하기, -a는 수정된 파일들에 대해서만 커밋함
# 하지만 새로운 파일은 자동으로 추가하지 않음
git commit -a -m "xx"
git commit -m "xx"
Branch
git init
echo z>z.txt
git add z.txt
git commit -m "z.txt"
git branch b1
git remote add origin https://github.com/nowage/test
git fetch --all
git reset --hard origin/master
git pull origin master
git checkout b1
git rebase master
# 충돌 있으면 master로 checkout 후 → git add [해당파일];git rebase --continue;vi [해당파일];git add -A
git checkout master
git merge b1
git branch -d "b1"
ls
git push
Clone
## 저장소로 이동
cd ~/src
## bare clone
git clone --bare . ../remote-repository.git
## General clone
git clone gitPath
git clone shiny@R-graph.com:/git/ttest.git
충돌 해결
vi README.md
git commit -a -m "README.md change"
git pull ## 같은 파일이라도 다른 부분을 수정하면 자동 merge됨
# git status # 자동 merge 안되면
# git diff # 자동 merge 안되면
# vi README.md # 자동 merge 안되면
git add README.md
git commit -m "complicted clear"
git push
다른 저장소로 변경내용 Push 하기
Add Remote
# ../remote-repository.git 저장소를 origin으로 추가한다.
git remote add origin https://xxxxxxxx/remote-repository.git
# 자 현 저장소(working copy)에 수정을 가한다.
echo "I added a remote repo" > test02
# Staging index 로 commit 한다.
git commit -a -m "This is a test for the new remote origin"
# origin으로 push 한다. 만일 git push 만 입력할 경우 자동으로 origin으로 보내게 된다.
git push origin
git tag # 태그 목록 보기
git tag 태그명 [커밋 아이디] # 태그 생성 (light weight tag)
git tag -a 태그명 -m 태그설명 [커밋아이디]# 태그 생성 (annotated tag)
git tag -d 삭제할태그명 # 태그 삭제
git push --tags # 태그 원격 저장소로 업로드
git show 태그명
git tag 태그명
git config format.pretty oneline : 이력(log)에서 확정본 1개를 딱 한 줄로만 표시하기
git add -i : 파일을 추가할 때 대화식으로 추가하기
OSX .gitignore
# General
*/.*
# for macOS
.DS_Store
.AppleDouble
.LSOverride
## Icon must end with \r
Icon?
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# for Python and Jupyter
__pycache__
*/*.pyc
## Jupyter
.Trash-0
**/.ipynb_checkpoints
**/.ipynb_checkpoints/*.ipynb