DevOps/Git

[GitHub / Git] (git reset) push ํ›„ commit์„ ์ง€์šฐ๊ณ  ์‹ถ์„ ๋•Œ !

chaerlo127 2023. 4. 12. 01:58
728x90

commit ํ•œ ๊ฒƒ์„ push ํ–ˆ๋Š”๋ฐ ์ž˜๋ชป ์˜ฌ๋ฆฌ๊ฒŒ ๋˜์–ด ๊ทธ commit์„ ํ”์ ๋„ ์—†์ด ์ง€์šฐ๊ณ  ์‹ถ๋‹ค๋ฉด git revert ๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. 

 

git log

๋ฅผ ํ†ตํ•ด์„œ commit ์ด๋ ฅ์„ ํ™•์ธํ•œ ๋’ค, ์ด๋™ํ•˜๊ณ  ์‹ถ์€ commit์˜ id ๋ฅผ ์ฐพ๋Š”๋‹ค. 

 

git reset [commit id]

 

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์›ํ•˜๋Š” commit ์œผ๋กœ ์ด๋™ ํ›„

 

git push origin main

 

ํ•˜๋ฉด ๋!! ์ด๋‹ค. 

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์—๋Ÿฌ๊ฐ€ ๋‚œ๋‹ค๋ฉด?

git push origin +main

 

ํ•˜๋ฉด ๋

 

[์ถœ์ฒ˜]

https://velog.io/@rkio/Git-push-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0

728x90