The BEST git command you've never heard of | GIT ADD PATCH

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

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

  • @willernst
    @willernst Год назад +9

    Sooo great! This is that next level git workflow I've seen one or two developers do that blew my mind. This is such a clear and concise explanation that it seems trivial.

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

    This is the most important thing I have see with Git.
    I always struggle to manual stages files and need remove some part to just do a simple commit but this tools is just amazing and could really save me a lots of works and times !
    Thanks a lots for your channel and all those wholesome videos ! ❤

  • @RichardONeil
    @RichardONeil Год назад +1

    Fantastic! I love the speed, no cruft.

  • @oxolov
    @oxolov Год назад +7

    You can do this in almost every git GUI... and with so much more ease - generally just select the lines you want to stage and press a button.

    • @shivangrathore
      @shivangrathore 8 месяцев назад

      I tried doing this for hours in vscode, failed miserably. I tried for hours but no help. Then I used git patch and wow

  • @vouneo
    @vouneo Год назад +4

    This is my new favourite channel

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

      I agree. Feels like I found this gold vein in the vast trash pile of coding youtube channels with lazy content aimed to generate cash flow only. And I am super conflicted if I want to share this channel as it deserves or selfishly keep it to myself. :D This creator gives me fireship-level-quality-vibes.

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

    *"This was such a good video, like, oh my gosh!"* - me, probably.
    Liked and subbed 🎉

  • @emko333
    @emko333 Год назад +3

    you can do the same in lazygit with line commit, just select the chunks you want in the commit

    • @typecraft_dev
      @typecraft_dev  Год назад +1

      lazygit does seem really cool, I've been playing with lately

    • @hglbrg
      @hglbrg Год назад +1

      I use lazygit over anything else, but I have never bothered to learn for instance the partial hunk thing but rather just avoided changing unstaged (but changed) files until I've managed to stage (and commit usually) them. I think this is a good approach generally (to work with one thing at a time) but there are times where I saw something small that I want to change in a file while working in it - and that change has nothing to do with the commit I am working on atm but should be its own. Most of the time when that happens I just go "meh I'll do it after, I will totally remember to do it after". Works 2 out of 10 times. :P
      In addition: While Lazygit is amazing, as is most git-GUI things in most IDEs (let's be honest), I do think it is very good to understand what your GUI does in the background so I would always recommend people to learn "manual" git commands, at least add, diff, status, fetch, pull, push, commit and stash - as well as understand what actually happens when you use them. Otherwise you'll end up in a bind when your button (or CLI-option) doesn't work and you have no idea why.

  • @fedeanastasis7040
    @fedeanastasis7040 Год назад +3

    When chris typed git ci, an editor opened up that let them write the message, do anyone how to recreate that?

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

      Oh sorry I didn’t mention in the video! It’s an alias for git commit -v

  • @Caminante-blanco
    @Caminante-blanco 6 месяцев назад

    Thank you! This has totally changed how I use git

  • @peteryates308
    @peteryates308 Год назад +1

    I use tig for this, I find it easier than going through the hunks sequentially. I'm neither young or hip enough to use lazygit.

  • @陸安
    @陸安 Год назад +1

    Hi! Can you share your config of buffer line (or tab line?) on the top of terminal? It’s really beautiful! Thanks you!

    • @typecraft_dev
      @typecraft_dev  Год назад +1

      Sure! I’m using Dracula: draculatheme.com/tmux
      I see my status bar to top position and turn on the option to display the status bar in Dracula

    • @陸安
      @陸安 Год назад

      Thanks a lot!!!

  • @BrunoVinicius-ix8wt
    @BrunoVinicius-ix8wt Год назад +1

    I didn't know about that. Gonna practice this from now on =D

  • @LudoTechWorld
    @LudoTechWorld Год назад +1

    Completely new to me, very usefull and very well explained, thanks!

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars Год назад +1

    simple and to the point, thank you
    willl definitely use this :)

  • @lungoo2168
    @lungoo2168 Год назад +1

    Thanks for the helpful video. One Question: Can you share your git aliases ?

  • @user-rz1hv
    @user-rz1hv Год назад

    Almost any gui client allows that such as git-gui or the built-in gui in vs code like you just select lines and add them to stage with right click.
    The problem with all that is it's not a universal solution, at first I also thought it would allow me to rewrite the whole history of my pet projects but when I tried to do that I encountered some problems like there are sometimes "garbage" changes like dependencies in configuration files, configuration changes you never bothered to look up or just dozens of imports from a bunch of official libraries, especially the latter. I called these changes garbage bc they are meaningless when you look at them in git client while making commits.

  • @veselin4504
    @veselin4504 Год назад +1

    I love your narrating

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

    I love that you use correct commit messages, stating what _this commit_ does (if applied), not what _you_ did in your workday.

    • @TheSast
      @TheSast Год назад +1

      No, they are using the truncated infinite / imperative tense (add gitsigns vs adds gitsigns), they are giving an order to the commit to do something, which is the worst possible type of messags in my opinion, past or present tense are more intuitive.

  • @shivangrathore
    @shivangrathore 8 месяцев назад

    I tried doing this for hours in vscode, failed miserably. I tried for hours but no help. Then I used git patch and wow

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

    The git client for emacs: magit does this 🙌

  • @heltengundersen
    @heltengundersen 2 месяца назад

    Better use 's' to split a hunk instead of edit. Much faster.

  • @farzadmf
    @farzadmf Год назад +1

    Or ... we could use Lazygit to do that (as I see you're using it as well 🙂)

    • @typecraft_dev
      @typecraft_dev  Год назад +1

      Love lazygit! It’s also nice to understand what happens under the hood

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

      It is indeed, that's why it's called "lazy" git; you forget these things (although its command history pane is really useful to learn stuff in case someone wants to)

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

    awesome, ty

  • @gauff3r
    @gauff3r 6 месяцев назад

    nice

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

    Great content but waaay waaayy too fast.

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

    clickbait.
    When the thumbnail hints at a graphical info aid but there aint any in the content.
    -_-

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

      Not to worry, you can do the same thing in VSCode