티스토리 뷰
<git 로컬 환경>
깃을 운영체제에 맞게 설치한후
https://git-scm.com/download/win
git bash에서 작업.
**폴더를만든다
*git init 으로 초기화 !(깃용 레포짓토리만들어줌)
*echo "내용" > 제목.txt : 폴더에 텍스트 파일 생성한다
*ls 리스트확인 / --미
*cat 제목.txt 내용보기
*git statu 깃 레퍼짓토리 상태 보기
초록색은 add 된 것 빨간색은 add 안 된 것
*git add . : 전체 staging영역으로 올리기
작업폴더에서 --> staging영역으로(확정아닌데 변경사항으로 인정해줌)
*git commit -m "커밋내용 잘 적어주기" : 커밋하기
staging영역에서 --> repository로 올리기.
user@LAPTOP-AC3UDB1J MINGW64 ~
$ git config --global user.name s0109890
user@LAPTOP-AC3UDB1J MINGW64 ~
$ git config --global user.email leeseungmin12@gmail.com
user@LAPTOP-AC3UDB1J MINGW64 ~
$ mkdir sample-repo
mkdir: cannot create directory ‘sample-repo’: File exists
user@LAPTOP-AC3UDB1J MINGW64 ~
$ cd sample-repo
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo
$ git init
Initialized empty Git repository in C:/Users/user/sample-repo/.git/
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ echo "terererere" > smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ ls
smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ cat sample.txt
cat: sample.txt: No such file or directory
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ cat smaple.txt
terererere
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
smaple.txt
nothing added to commit but untracked files present (use "git add" to track)
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git add smaple.txt
warning: LF will be replaced by CRLF in smaple.txt.
The file will have its original line endings in your working directory
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ mkdir child-dir
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ ls
child-dir/ smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ echo "cccc" > child-dir/sample.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ cat child-dir/sample.txt
cccc
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git commit -m "First Commit"
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
child-dir/
nothing added to commit but untracked files present (use "git add" to track)
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git add .
warning: LF will be replaced by CRLF in child-dir/sample.txt.
The file will have its original line endings in your working directory
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git commit -m "First Commit"
[master 5f20c73] First Commit
1 file changed, 1 insertion(+)
create mode 100644 child-dir/sample.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
nothing to commit, working tree clean
[깃 커밋하기]
git commit -m "first commit"
[깃 로그]
: 커밋의 아이디로 커밋포인트 식별.
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git log
commit 5f20c7384236c21e0097ecca62a07dfdbe7bb5c6 (HEAD -> master)
Author: s0109890 <leeseungmin12@gmail.com>
Date: Mon Feb 7 14:09:05 2022 +0900
First Commit
commit 364e11240e740158ddd33b130c024b946472e420
Author: s0109890 <leeseungmin12@gmail.com>
Date: Mon Feb 7 13:47:25 2022 +0900
first commit
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git log --oneline
5f20c73 (HEAD -> master) First Commit
364e112 first commit
[파일 수정하여 다시 커밋하기.]
*echo "내용" >> 제목.txt : 파일수정 !! 폴더에 텍스트 파일에 한줄 더 추가하여 내용을 추가한다
*git diff : 제목txt의 변경내용을 보여준다.
*git statu 깃 레퍼짓토리 상태 보기
초록색은 add 된 것 빨간색은 add 안 된 것
*git add . : 전체 staging영역으로 올리기
작업폴더에서 --> staging영역으로(확정아닌데 변경사항으로 인정해줌)
*git commit -m "커밋내용 잘 적어주기" : 커밋하기
staging영역에서 --> repository로 올리기.
*git log : 맨위의 커밋이 추가된거!!
[파일 add(staging-> folder) 되돌리기 ]
*git reset
*git reset --hard 파일 변경 다 지우고 ! 커밋(HEAD)올렸던 상태로 되돌리기
*git reset --hard 364e11240e740158ddd33b130c024b946472e420 파일 특정 커밋 포인트로 되돌리기
HEAD -> Master : 지금 커밋의 위치 !
commit 364e11240e740158ddd33b130c024b946472e420
Author: s0109890 <leeseungmin12@gmail.com>
Date: Mon Feb 7 13:47:25 2022 +0900
first commit
git reset : stagig에 올린것 내리기
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ echo '하하' > smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git diff
warning: LF will be replaced by CRLF in smaple.txt.
The file will have its original line endings in your working directory
diff --git a/smaple.txt b/smaple.txt
index 0b7a716..4ed36d4 100644
--- a/smaple.txt
+++ b/smaple.txt
@@ -1 +1 @@
-revise
+하하
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git add .
warning: LF will be replaced by CRLF in smaple.txt.
The file will have its original line endings in your working directory
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ echo '하하' >> smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git add .
warning: LF will be replaced by CRLF in smaple.txt.
The file will have its original line endings in your working directory
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git reset
Unstaged changes after reset:
M smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
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: smaple.txt
no changes added to commit (use "git add" and/or "git commit -a")
git reset --hard
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ cat smaple.txt
하하
하하
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: smaple.txt
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git reset --hard
HEAD is now at d314374 child_add
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ cat smaple.txt
revise
git reset --hard 364e11240e740158ddd33b130c024b946472e420
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git log
commit d314374d1ed1b81391f152018f88bb2db1147ad2 (HEAD -> master)
Author: s0109890 <leeseungmin12@gmail.com>
Date: Mon Feb 7 14:29:00 2022 +0900
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git reset --hard 364e11240e740158ddd33b130c024b946472e420
HEAD is now at 364e112 first commit
user@LAPTOP-AC3UDB1J MINGW64 ~/sample-repo (master)
$ git log
commit 364e11240e740158ddd33b130c024b946472e420 (HEAD -> master)
Author: s0109890 <leeseungmin12@gmail.com>
Date: Mon Feb 7 13:47:25 2022 +0900
first commit
'DevOps > git' 카테고리의 다른 글
유니티 협업툴 SCM ..? / git hub 그리고 LFS (0) | 2022.10.06 |
---|---|
gitignore (0) | 2022.04.19 |
DevOps_github_원격 (0) | 2022.02.07 |
- Total
- Today
- Yesterday
- VR
- TouchDesigner
- StableDiffusion
- unity 360
- 후디니
- Arduino
- JacobianMatrices
- emotive eeg
- Unity
- 유니티플러그인
- CNC
- node.js
- RNN
- motor controll
- Python
- docker
- MQTT
- three.js
- Java
- colab
- ardity
- opencv
- houdini
- Express
- DeepLeaning
- 유니티
- AI
- sequelize
- 라즈베리파이
- oculuspro
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 |