inblog logo
|
{CODE-RYU};
    git

    git reset

    Jan 02, 2024
    git reset
    Contents
    1. git soft2. git mixed3. git hard
     
    πŸ’‘
    ν˜„μž¬ HEAD 의 포인트λ₯Ό λ³€κ²½ν•΄ 기둝을 μˆ˜μ •ν•˜κ±°λ‚˜, νŠΉμ • 파일둜 되돌릴 수 있음
    notion image
     
    git soft :commit log λ³€κ²½μ‹œ μ‚¬μš© git mixed : μž‘μ—… μ˜μ—­μ˜ λ‚΄μš© λ³€κ²½μ‹œ μ‚¬μš© git hard : 이전 λ‹¨κ³„λ‘œ λ³€κ²½μ‹œ μ‚¬μš©
     
     
    notion image
     
     
     
    [test reset1] public class Reset { public static void main(String[] args) { System.out.println("1"); } }
     
    [test reset2] public class Reset { public static void main(String[] args) { System.out.println("1"); System.out.println("2"); System.out.println("3"); } }
    notion image
     
    λ‘λ²ˆμ˜ commit 을 ν–ˆλ‹€.
     
     

    1. git soft

    git reset --soft ν•΄μ‹œκ°’
    notion image
    notion image
    notion image
     
    HEAD κ°€ test reset2 μ—μ„œ reset1 으둜 λ³€κ²½λ˜μ—ˆλ‹€.

    2. git mixed

    git reset ν•΄μ‹œκ°’
    notion image
    notion image
     
     

    3. git hard

    git reset --hard ν•΄μ‹œκ°’
    notion image
     
    notion image
    notion image
     
    hard λ₯Ό μ‚¬μš©ν•˜λ©΄ commit μ΄μ „μœΌλ‘œ λŒμ•„κ°„λ‹€.
     
    Share article

    {CODE-RYU};

    RSSΒ·Powered by Inblog