πŸ“š Computer Science/Git

[Git] 원격저μž₯μ†Œμ— Push ν•œ Commit μ‚­μ œν•˜κΈ°

ibelieveinme 2024. 2. 15. 14:21
728x90

 

1. μ•„λž˜ λͺ…λ Ήμ–΄λ₯Ό 톡해 μ‚­μ œν•  commit 을 확인.

git log

 

 

2. κ°€μž₯ λ§ˆμ§€λ§‰μ— push ν•œ(κ°€μž₯ μœ„μ— μžˆλŠ”) commit 을 μ§€μš°κ³  μ‹ΆκΈ° λ•Œλ¬Έμ— λ‹€μŒ λͺ…λ Ήμ–΄λ₯Ό μ‚¬μš©ν•˜μ—¬ commit 을 μ‚­μ œν•œλ‹€.

git reset HEAD^

 

 

3. 그리고 λ‚΄κ°€ commit 을 μ§€μ› λ‹€λŠ” 것을 github μ„œλ²„μ— μ•Œλ €μ£Όμ–΄ github λ‚΄μ—μ„œλ„ ν•΄λ‹Ή commit 을 μ‚­μ œν•˜λ„λ‘ ν•œλ‹€.

git push -f origin "브랜치λͺ…"

 

cf) master μ—μ„œ push ν•œ commit 을 μ‚­μ œν•˜λ €λ©΄ git push -f origin master λ₯Ό μž…λ ₯ν•΄μ£Όλ©΄ λœλ‹€.

728x90