시작 전 QnA
Node.js
와 MongoDB
가 있음commmit
단위로 관리, 배포 뿐 아니라 원하는 시점으로 Checkout
가능Branch
로 개발하여 편안한 실험이 가능하며, 성공적으로 개발이 완료되면 Merge
하여 반영Windows
의 경우 공식 홈페이지보다 아래 링크의 Git
을 쓰는 것이 좋다.
👉 https://gitforwindows.org/
Git Bash
에서 다음 명령어로 Git
버전을 확인할 수 있다.
$ git --version
$
: 쉘 프로그램이 사용자의 명령을 받을 준비가 되어있다는 의미~
: 현재 로그인한 사용자의 최상위 폴더를 의미(특별한 권한 없이 모든 작업을 수행할 수 있는 공간)ls
ls -a
ls -l
ls -al
cd {폴더명}
cd ..
cd .
cd
mkdir {디렉터리명}
touch {파일명.확장자}
mv {파일명.확장자} {디렉터리명}
mv ../server.js ./
server.js
이동cp {파일명.확장자} {디렉터리명}
cp hello.md ./hello-copy.md
hello-copy
라는 이름으로 hello
를 현재 디렉터리에 복사mv ../server.* ./
server
라는 파일명을 가진 파일을 현재 디렉터리로 이동rm server.*
server
라는 파일명을 가진 파일을 모두 삭제rm
rm -r {디렉터리명}
-r
로 삭제되지 않는다면 -rf
mv {현재파일명.확장자} {새파일명.확장자}
Tab
을 누르면 자동완성됨&&
를 사용해 여러 명령어를 한 번에 입력 가능마우스 사용이 되지 않아 키보드로 모든 일을 수행해야 한다.
vim {파일명.확장자}
i
: 끼워넣기o
: 라인을 열고 끼워넣기:w
: 저장하기:q
: 나가기:wq
: 저장하고 나가기:q!
: 저장하지 않고 나가기cat {파일명.확장자}
💡 tip: .swp(스왑파일).
Vim
작업 중 저장되지 않은 채로 종료되면 임시 파일이 생기는데, 이를 삭제하고 재진행 하는 것이 좋음
git add
해서 stage에 올리고, 그에 대한 메시지를 작성하는 것이 git commit
$ git config --global user.name "git 유저네임"
$ git config --global user.email "git 가입 시 사용한 이메일"
$ git config --global core.editor "vim"
$ git config --global core.pager "cat"
GitHub이라는 원격 저장소에서 Local로 저장소를 복제
$ git clone https://github.com/jytrack64/first-repo.git
❗ 초반에는 git status
를 생활화하기
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
$ git remote
origin
$ git add README.md
$ git commit
git commit -m
사용하지 않기Merge
시 기본적으로 존재하는 메시지가 있는 경우가 있는데, -m
를 사용하게 되면 override의 가능성이 존재👉 따라서 Vim
으로 작성하는 것을 권장
commit
시 제목과 내용 구분 할 것(첫 째줄: 제목, 줄 바꿈 두 번: 내용)
Vim
에서 메시지를 작성하지 않고 나오거나 저장하지 않으면 commit
이 되지 않음
commit
메시지를 잘 남기는 것도 중요하지만, 작업 단위를 잘 나누는 것 또한 정말 중요하다. 작업 단위를 제대로 구분하지 않는다면 파일의 히스토리를 남기기가 어려워진다.
commit
한다.ref: https://www.conventionalcommits.org/ko/v1.0.0/
commit
의 제목은 commit
(작업 단위)을 설명하는 문장이 아닌 구나 절로 완성importanceofcapitalize
/ Importance of Capitalize
)feat
: 기능 개발 관련fix
: 오류 개선 혹은 버그 패치docs
: 문서화 작업test
: test 관련conf
: 환경설정 관련build
: 빌드 관련ci
: Continuous Integration 관련refactor
: 개선💡 혼동 주의
fix
: 안 되던 걸 고쳐서 잘 되게 만든 것refactor
: 잘 동작은 하고 있었으나 효율이 떨어지는 코드를 수정한 것, 코드 품질 개선
orgin
이라는 별칭을 가진 main branch
에 commit
을 push
하는 것
$ git push origin main
GitHub 저장소를 활용해 정적인 사이트 호스팅이 가능하다.
👉 username
.github.io
$ hexo
$ hexo init blog
$ cd blog
$ npm install
$ hexo generate
$ hexo server
Node.js
, React
, Hexo
작업 시 모두 움직이지 않고, package.json
이 있는 곳에서 작업해야 함
$ hexo new post "My first hexo blog"
INFO Validating config
INFO Created: ~\Documents\dev\blog\source\_posts\My-first-hexo-blog.md
$ vi source/_posts/My-first-hexo-blog.md
$ hexo clean && hexo generate
저장소 이름은 username
.github.io
vi _config.yml
명령어 입력 후, config.yml
에서 title, author, deploy(type, repo, branch)
부분 수정 후 저장
# Site
title: JYTrack
subtitle: ''
description: ''
keywords:
author: Ji-yeon
language: en
timezone: ''
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://jytrack64.github.io
.
.
.
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/jytrack64/jytrack64.github.io.git
branch: main
$ npm install hexo-deployer-git --save
테마를 설치한 후,
$ npm install hexo-theme-next --save
$ vi _config.yml
_config.yml
에서 theme
를 'next'로 수정한다.
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
💡 tip: Ctrl + Shift + R(캐시 파일 삭제 후 페이지 새로고침)
$ hexo clean && hexo generate
배포까지 마치면 hexo server
로 서버를 실행하지 않고도 GitHub 주소(https://jytrack64.github.io)로 블로그를 접속할 수 있다!
$ hexo deploy
ref: https://github.com/wayhome25