티스토리 뷰
반응형
Git 이란? (Official page)
- 버전 관리 시스템
- CLI or GUI(Graphic user interface) 중에 선택 가능
- GUI: sourcetree, gitkraken
- CLI: Command terminal, git bash, iterm 등
- vscode extension : GitLens
Github vs Git
- Git: 버전 관리 시스템 (주로 로컬)
- Github: 버전 관리 웹호스팅 서비스
Git 기본 순서
- initialize or clone from Github
- Add modified files (staging)
- Commit with message
- Push to GitHub
Git branch
co-work with other developers with the same repository.
Each branch are independent
After the work is done, merge with other branches
"Master" branch is made with the git init
Git Install [link]
Git settings
# set global user name and email
git config --global user.name "<your name>"
git config --global user.email <your email>
# Mac or linux
git config --global core.autocrlf input
#Window
git config --global core.autocrlf true
# For more
git config --help
Git basic commands
# Init repository
git init
# Clone from github
git clone repository-url
# Stage file
git add your_file #Single file
git add your_file your_file2 # multiple files
git add *.txt # Pattern
git add . # Everything
# View status
git status
# Commit
git commit -m "message" # single line
git commit -m "message1" -m "message2" # multiple line
git reset --soft HEAD^ # Remove last commit, keeps add
git reset --mixed HEAD^ # Remove commit and added files
git reset --hard HEAD^ # Discard local changes
# Remove files
git rm filename # remove from dir and staging
git rm --cached filename # remove from staging only
# View Changes
git diff
# view history
git log
git log --graph --oneline --decorate --all # Better way
# View commit
git show head #Last commit
# Undo git add
git restore --filename
Branch merge pull push
# Branch
git branch newbranch # create branch
git switch newbranch # switch to branch
git swith -C newbranch2 # create and switch
git branch -d newbranch # delete branch
# Merge
git merge newbranch # Merge the newbranch into the current branch
git merge --squash newbranch # squash merge
# remot
git remote add test your-github-repository # add remote repository named test(optional, default it origin)
git remote -v # Check for remote repository
git remote rm test # remove remote repository
# Push
git push origin branch-name # Usually master for beginner, pushes from the local machine to the server
# Pull
git pull origin # Pull from the server to your local machine, merges
# Fetch
git fetch origin master # Just download from the server to your local machine
Fork
Making a copy of other person's repository into my account.
Pull request [link]
반응형
'Development' 카테고리의 다른 글
[Nginx] sites-available vs sites-enabled (0) | 2021.02.03 |
---|---|
[Editor] Vim 익숙해지기 (0) | 2020.12.26 |
[linux] 기본 명령어 (0) | 2020.09.06 |
WSL2에 Ubuntu cli, gui 설치 (0) | 2020.08.19 |
Google Colab에 csv 파일 로드 하는 방법 3가지 (0) | 2020.07.23 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Gemma
- Binary
- K8S
- feed-forward
- csv
- Fine-Tuning
- Container
- palindrome
- 나는리뷰어다
- docker
- book
- error
- lllm
- 키보드
- Shell
- 한빛미디어
- kubernetes context
- AWS
- Git
- Python
- go
- 파이썬
- kubens
- Algorithm
- collator
- Kubernetes
- LLM
- BASIC
- 책리뷰
- leetcode
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함
반응형