티스토리 뷰
실전활용 Git 고급 주제
$ echo hi > new.txt 생성
1.내가 지금 까지한 작업을 전부다 저장해놓기 작업중인작업 stash 사용
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
Github_seminar2/
new.txt
nothing added to commit but untracked files present (use "git add" to track)
김관현@KGH MINGW64 ~/hello (master)
$ git add new.txt
warning: LF will be replaced by CRLF in new.txt.
The file will have its original line endings in your working directory.
김관현@KGH MINGW64 ~/hello (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: new.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
Github_seminar2/
김관현@KGH MINGW64 ~/hello (master)
$ git add Guthub_seminar2/
fatal: pathspec 'Guthub_seminar2/' did not match any files
김관현@KGH MINGW64 ~/hello (master)
$ git add Guthub_seminar2
fatal: pathspec 'Guthub_seminar2' did not match any files
김관현@KGH MINGW64 ~/hello (master)
$ git add Github_seminar2
김관현@KGH MINGW64 ~/hello (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: Github_seminar2
new file: new.txt
김관현@KGH MINGW64 ~/hello (master)
$ git checkout -b testing
fatal: A branch named 'testing' already exists.
김관현@KGH MINGW64 ~/hello (master)
$ git checkout testing
A Github_seminar2
A new.txt
Switched to branch 'testing'
김관현@KGH MINGW64 ~/hello (testing)
$ git stash
Saved working directory and index state WIP on testing: 5b79623 modify
warning: unable to rmdir Github_seminar2: Directory not empty
HEAD is now at 5b79623 modify
김관현@KGH MINGW64 ~/hello (testing)
$ git config user.email "ani"
김관현@KGH MINGW64 ~/hello (testing)
$ git config user.name "ani"
김관현@KGH MINGW64 ~/hello (testing)
$ git stash
No local changes to save
김관현@KGH MINGW64 ~/hello (testing)
$ git status
On branch testing
Untracked files:
(use "git add <file>..." to include in what will be committed)
Github_seminar2/
nothing added to commit but untracked files present (use "git add" to track)
김관현@KGH MINGW64 ~/hello (testing)
$ git stash pop
On branch testing
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: Github_seminar2
new file: new.txt
Dropped refs/stash@{0} (0da17e4fd4320d92abd443522e420e01f83eedb1)
2. 태그를 걸어 놓는다. 버전의 태그를 갖고 쫓아간다
$git tag
3. 멀티 리모트 저장소
내가 작업하다가 -> 회사로 보낼때
$ git remote -v
origin https://github.com/kgh940525/Github_seminar.git (fetch)
origin https://github.com/kgh940525/Github_seminar.git (push)
$git remote add personal ("새로운 repository address add").git( git을 쳐도되고 안쳐도되고)
$git push personal master
이런식으로 -> 새로운 저장소를 두개를 만들어서 따로 보낼 수 있도록
4.git reflog
김관현@KGH MINGW64 ~/hello (testing)
$ git reflog
5b79623 HEAD@{0}: reset: moving to HEAD
5b79623 HEAD@{1}: checkout: moving from master to testing
eeb553a HEAD@{2}: revert: Revert "add test.js"
5b79623 HEAD@{3}: checkout: moving from testing to master
5b79623 HEAD@{4}: merge master: Fast-forward
1c1483b HEAD@{5}: checkout: moving from master to testing
5b79623 HEAD@{6}: commit: modify
1c1483b HEAD@{7}: reset: moving to 1c1483bb4efd607ac5e7d01e87b3631a0082831e
daaa796 HEAD@{8}: commit: hello.html modi
1c1483b HEAD@{9}: reset: moving to 1c1483bb4efd607ac5e7d01e87b3631a0082831e
1c1483b HEAD@{10}: merge testing: Fast-forward
b1bfb50 HEAD@{11}: checkout: moving from testing to master
1c1483b HEAD@{12}: commit: add test.js
b1bfb50 HEAD@{13}: checkout: moving from master to testing
b1bfb50 HEAD@{14}: commit: hello.html
50bcbcd HEAD@{15}: commit: add styling
cb5bbf8 HEAD@{16}: commit (initial): add hello.html
-> 커밋 내용들 여기다가 다 기록이 된다.
'Github' 카테고리의 다른 글
[Github]T Academy Seminar - 2 브랜치 (0) | 2017.12.22 |
---|---|
[Github]T Academy Seminar - 1 기본 사용법 (0) | 2017.12.22 |
[Github] 깃허브정리 - 3 (0) | 2017.09.22 |
[Git Hub] 깃허브 정리 -2 (0) | 2017.09.22 |
[Github] Github 협업 Pull Request 과정 정리 (0) | 2017.09.13 |
- Total
- Today
- Yesterday
- db
- 노드
- C언어
- 프로그래밍
- node.js
- 백준
- TensorFlow
- 리버싱
- 머신러닝
- Algorigm
- 개발하는 관광이
- Android
- 감자코딩
- Controller
- 텐서플로우
- Spring
- node
- C langauge
- 초보자를 위한 C언어 300제
- BFS
- 코드엔진
- 알고리즘
- programming
- 학교
- 안드로이드
- 백준알고리즘
- 감자개발자
- 복습
- MVC
- 스프링
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |