Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- AllArgsConstructor
- spring mapper
- 도커 로그 확인
- JAVA Exception 종류
- JPA DB 다중 Connection
- Transactions Propagation Option
- spring mapper annotation
- Spring
- spring DB Connection
- NoArgsConstructor
- spring @mapper
- Spring JPA Specification
- JPA DB Connection 다중
- Data Annotation
- @Builder @NoArgsConstructor
- docker 로그
- repository annotation
- 도커 logs
- 도커 컨테이너 로그
- spring JPA DB Connection
- vueslot
- spring JPA DB multi Connection
- vuecomponent
- spring repository
- Vue
- 자바버그수정
- doker logs tail
- JpaRepository update
- mapper annotationo
- CrudRepository update
Archives
- Today
- Total
개발을 잘하고 싶은 개발자
[git] git stash 잠시 저장해두고 싶어 본문
git이 없었으면 협업 시 얼마나 힘들었을까...
상상해본다면 너무 끔찍하다ㅠ
나는 나름대로 git을 오래썼고 유용하게 써왔다고 생각하는 git팬 중 하나다 ㅎㅎ
오늘은 git 의 여러 기능 중 하나인 stash를 소개하는 글을 써본다
참고 https://git-scm.com/book/ko/v2/Git-%EB%8F%84%EA%B5%AC-Stashing%EA%B3%BC-Cleaning
Git - Stashing과 Cleaning
작업하던 저장소가 완전 지저분해져서 Git에게 진짜로 강제로 정리하도록 해야 하는 경우가 생길 수 있다. 예를 들어 Git 버전관리 데이터가 포함된 디렉토리를 복사해왔거나 서브모듈 디렉토리
git-scm.com
여기 스테이지에 올라가지 않은 파일이 있다


갑자기 이 trace.vue 파일 수정한 거 말고 다른 파일 수정해서 올려달라고 요청이 온다...

- 수정한 내용을 다른곳에 복사해두고 나중에 다시 복붙 하면 되지? (Copy + C, V)
- 파일이 하나가 아니면?? 1 2 3 4 5 ... 100??👀
- 갑자기 온 요청이 같은 파일 같은 라인 수정이면???🗃🗃
- 수정한 곳이 여기저기여기저기저기여기요기쪼기면????😵💫😵💫
복붙은 한계가 있다.
그래서 내가 작업한 나의 trace.vue 파일을 항아리에 잠시 담아두려 한다(스택)
- git stash
뭐지? 성공한 건가? 소스는 다시 원복 되었는데 내가 수정한 거 어디 갔지?$ git stash Saved working directory and index state WIP on dev: 13d2dd5 마지막 커밋 내용 어쩌구저쩌구
빨리 확인이 필요했다...!
git status는 당연히 비어있고 서둘러 아래 - git stash list
이 명령어로 항아리(스택)에 담아둔 내 파일들이 잘 있는지 확인한다
다행히 잘 있는 걸 확인할 수 있었다 ㅎㅎ$ git stash list stash@{0}: WIP on dev: 13d2dd5 마지막 커밋 내용 어쩌구저쩌구 stash@{1}: WIP on master: 736a64c TEST3 stash@{2}: WIP on JV15-154: 736a64c TEST2 stash@{3}: WIP on master: 3b261d2 TEST1
stash@{0} - git stash pop
급하게 온 요청 건들을 빠르게 Complete 해버리고!
다시 수정했던 trace.vue를 되돌려야 한다.
이때 사용하는 명령어가 "pop"이다
말 그대로 팝콘처럼 팝!ㅎㅎ
$ git stash pop
On branch dev
Your branch is behind 'origin/dev' by 4 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
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: pages/order/trace.vue
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (57b5fcc1d66fa8827172c9daeef912809ec06f67)
4. git stash pop show stash@{2}
만약 위의 stash들 중에 중간에 있는 stash@{2}의 내용이 궁금하다면
$ git stash show stash@{2}
nuxt.config.js | 6 +++---
pages/common/code.vue | 20 ++++++++++++++++----
2 files changed, 19 insertions(+), 7 deletions(-)
이렇게 확인도 가능하다.

'git' 카테고리의 다른 글
git stash pop, git stash apply, git stash drop (0) | 2024.01.11 |
---|