git file
- making savepoints, can roll back to other versions
git add filename.txt //adding one by one
git add . //everything inside the current directory is added to the staging area
*working directory
folder/directory where you initialize your git repository
-$ git init
*staging area
-$ git add
(working dir => staging area)
pushing selected new file(s) into staging area
putting files that you want to keep track of
*local repository
-$ git commit
(staging area => local repository)
backup versions
$ git checkout filename.txt
=>asking to roll back to the last version updated ( checkpoint )
Github and remote repositories
- $ git remote add origin https://github.com/sts07024/Story.git
=>now able to push our local repository onto our remote repository(here, named "origin")
- $ git push -u origin master
=>pushes your local repository to the remote repository using the -u flag(option) which basically links up
your remote and local repositories
and then we're going to push it towards the remote named origin, and we're going to push it to the branch named master
master branch: the default(main) branch of all of your commits
gitignore
- staging area 에서 commit할 파일로 올려둔 곳에서 제거할 때
- $ git rm --cached -r .
- =>모든 파일 제거
- $ git rm --cached -r .
.gitignore 파일 안에 파일 명 적으면 무시됨
*.txt =>.txt 형식의 모든 파일 해당
git cloning
copy the url of the repository
at terminal, clone it to our Desktop
- $ git clone URL
=>it'll clone into my very own local working directory!
Branching and Merging
$ git branch new-branch
=>새로운 branch 생성
$ git branch
=>현재 만들어져 있는 branch들 볼 수 있음, 옆에 * 붙어있는게 현재 위치한 것
$ git checkout new-branch
=>위치를 new-branch라는 이름을 가진 branch로 옮김
$ git merge another-branch
=>다른 branch를 현재 branch에 저장
'JavaScript' 카테고리의 다른 글
section 22 (0) | 2022.12.08 |
---|---|
note (1) | 2022.12.04 |
basic setup routine (0) | 2022.11.25 |
jQuery (0) | 2022.11.16 |
Advanced Javascript and DOM Manipulation (0) | 2022.11.16 |