Git Tutorial - Add and Edit Commits (Hunks)

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 18

  • @tyrisnolam
    @tyrisnolam Год назад +5

    I rewatch this video every time I forget how to edit hunks. Thanks a lot!

  • @newfc12
    @newfc12 7 месяцев назад +1

    Great explanations, thank you so much.

  • @PimpMyYugioh
    @PimpMyYugioh Год назад +2

    Very helpful!

  • @BooleanOperator
    @BooleanOperator 2 года назад +3

    I appreciate your detailed explanation, but I cannon see your cursor when you are indicating line 37 6:50

  • @AdityaSharma-ff7st
    @AdityaSharma-ff7st 2 года назад +2

    To the point and precise! Thanks

  • @dera_ng
    @dera_ng 5 месяцев назад

    Gold!

  • @MiKo-iz7tt
    @MiKo-iz7tt Год назад +1

    It would be more useful if you can zoom in to your screen, the color of the cursor doesn't see clearly, so I could appreciate better what are you doing.

  • @devstefancho
    @devstefancho Год назад

    Great tutorial!, do you use any plugin for git diff styling?

    • @BetweenTwoParens
      @BetweenTwoParens  Год назад

      Hey there! see github.com/athomasoriginal/dotfiles/blob/master/git/.gitconfig#L14

  • @privatename3621
    @privatename3621 2 года назад

    Thanks for posting. How did you get your git diff to look that way? I assume you are using an alias of some sort, as normally git diffs have a much different look.

    • @BetweenTwoParens
      @BetweenTwoParens  2 года назад

      Hey there, see github.com/athomasoriginal/dotfiles/blob/master/git/.gitconfig#L14

  • @kanumikechibundu2401
    @kanumikechibundu2401 2 года назад

    Nice content but the font is way too small. I had to strain my sight to see what you are doing . Thanks for the video though

  • @Дмитрий-т2л4ц
    @Дмитрий-т2л4ц Год назад +1

    Man, WTF :D
    You don't have to change the "hunk header" to edit the commit, git developers aren't that stupid.
    Just use the syntax git uses. Don't delete context lines and everything will be fine.
    (In your "example of apply path error" you deleted one context line: with curly brace)

    • @jonaskuliesius6802
      @jonaskuliesius6802 3 месяца назад

      Could you elaborate?

    • @Дмитрий-т2л4ц
      @Дмитрий-т2л4ц 3 месяца назад

      ​ @jonaskuliesius6802 hunk in this case is basically an instruction on how to change the file to get from previous version to the new version.
      It must follow some rules:
      if you add new line, you add "+" at the start of it
      if you delete existing line, you add "-" at the start of it
      if you do nothing with existing line, you add " " at the start of it
      (changing line is basically deleting old version, then adding new version)
      What he did after 5:05 is he removed line 22 starting with " " from the hunk. You can't do that.
      As said in comment below the hunk, you could remove "+" lines or you could change "-" lines back to " " lines.
      Deleting " " line is not correct hunk syntax, so it is only natural that git didn't like that. To delete such a line the correct way would be to change " " at the start of the line to "-", or better, don't touch that line at all and remove line 12 "+}".
      Changing "hunk header" (line 2) is completely pointless behaviour.

    • @Дмитрий-т2л4ц
      @Дмитрий-т2л4ц 3 месяца назад

      Although I should say that editing hunks was never intended to be a simple way of editing code.
      If you work with hunks very often, you should find some git GUI that will work with hunks for you.

    • @salehrezq
      @salehrezq 14 дней назад

      ​@@Дмитрий-т2л4ц ~As said in comment below the hunk, you could remove "+" lines~ and that what he did after 5:05

    • @Дмитрий-т2л4ц
      @Дмитрий-т2л4ц 13 дней назад

      @@salehrezq so, what's your point?