공부일지

[Git]특정 파일만 push 하고 싶을 때 본문

카테고리 없음

[Git]특정 파일만 push 하고 싶을 때

이르리의 공부일지 2023. 11. 24. 12:49

11/22

 

상황

필요한 변경사항만 add하고

(나머지는 git stash 해줬다. 안 그러면 변경사항이 남아있으니 add/stash하라고 뜨기 때문에!)

git push origin main 했는데 웹 사이트에 안 올라가 있다.

 


이유

# 이렇게 하지말자!
git add <file name>
git stash

 

 

git add <file name> 하고 commit 전에

git stash 를 해서 add 한 것도 stash돼 버린 것이다.

그러면 push가 안 된다.

 

# 이렇게 하자! stash 전에 commit 먼저!
git add <file name>
git commit -m "<commit name>"
git stash

 

 

 

특정 파일만 push 하고 싶을 때는

git stash 전에 commit 해주기!