Git - Reset (soft, mixed, hard) Vs. Checkout Vs. Commit

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 มี.ค. 2021
  • This video is part of the "Overcoming Fear Of Git" course:
    www.udemy.com/course/overcomi...
    What happens behind the scenes when we run git reset. How do branches and the HEAD react when we run git reset vs git checkout vs git commit

ความคิดเห็น • 11

  • @tosheen20
    @tosheen20 2 ปีที่แล้ว +5

    One of the best content and course regarding git!

  • @ShukyPersky
    @ShukyPersky 7 หลายเดือนก่อน +1

    It seems that the descriptions of what various reset --xxxx options are doing are wrong
    reset --soft: moves the deleted nodes stuff to staging area (while deleting "extra" nodes)
    reset --mixed: moves the deleted nodes stuff to working-area (while deleting "extra" nodes)
    reset --hard: moves deleted nodes stuff to garbage (while deleting "extra" nodes)
    thanks for the effort to produce this video

  • @shivangitomar5557
    @shivangitomar5557 ปีที่แล้ว +1

    Best video on the topic!! Thank you!

  • @s.mehradi
    @s.mehradi ปีที่แล้ว

    That sounds great !!! 😊

  • @030H
    @030H 2 ปีที่แล้ว +2

    Thank you. Very good explanation 👍

  • @rickdee888
    @rickdee888 2 ปีที่แล้ว +3

    It ended abruptly. May I know where is the continuation of this video?

    • @deepskript2220
      @deepskript2220  ปีที่แล้ว

      The full course's link is in the description of the video : )

  • @fnfal113
    @fnfal113 9 หลายเดือนก่อน

    while researching on google and doing various test locally; git reset ---mixed does not stage the changes automatically from the previously skipped commits but will be included in the working directory while git reset --soft stage the changes automatically. Please correct if mistaken.

  • @usefulknowledge6074
    @usefulknowledge6074 ปีที่แล้ว

    In 0:32, you said "git checkout branch or commit" moves the HEAD without the branch. I know that this is true for "git checkout commit" and that is why we get a detached HEAD warning. If you you said is also true for "git checkout branch_name", then why when we switch branches, we don't get a detached HEAD warning?

    • @deepskript2220
      @deepskript2220  ปีที่แล้ว +2

      We get detached HEAD warning if HEAD is not pointing to a branch. It's saying "hey, HEAD is not pointing to any 'branch' now..." So a branch points to a commit. HEAD can point to a "commit" or it can point to a "branch" which ultimately points to a commit. Let's say HEAD is currently pointing to branch A. After running git checkout B, HEAD will point to branch B so it's not "detached" ie it is attached to "branch" B. But if we run git checkout 4da57d. Then HEAD will point to "commit" 4da57d and we will get the warning because it's directly pointing to a commit instead of pointing to a branch. We can't say it's attached to a commit! I hope it helped 😊