git merge conflicts using vimdiff

Sdílet
Vložit
  • čas přidán 29. 06. 2024
  • How to resolve git merge conflicts using vimdiff.
  • Věda a technologie

Komentáře • 31

  • @gt10i
    @gt10i Před měsícem +1

    Thank you! You explained all the important points really well. Very useful, and still relevant tutorial even after 9 years.

  • @Remowylliams
    @Remowylliams Před 4 lety +4

    Hi Chong, I appreciate you trying to explain how to use a mergetool and using vimdiff as that tool. but it was really hard to follow. I've never used vimdiff at all and the commands and keys used did not advance my knowledge. Thank you for your effort.

    • @ChongKim
      @ChongKim  Před 4 lety

      I understand where you're coming from. I put a lot of effort into learning vim, took me 3 months before I got comfortable with it. I really wanted to know what the fuss was all about. I love vim because it is so powerful, but not perfect. IDEs (like pycharm) has a lot of nice features, but I find that it doesn't give me as much power as vim.
      In this video, I assumed you know vim since this was really about vimdiff. I wanted to show how 3-way merges work. When I say 3-way merge, people think they're doing a three-way merge because they see 3 windows (your changes, remote changes, and a working file), but that's just a regular merge. In order to have a 3-way merge, you also need to have the common ancestor window so you can see the changes before your changes and the remote changes. You can try out something like Beyond Compare, which costs $60 which has a 3-way merge (I haven't tried it). What I like about doing diffs in vim, is that I can turn off diff for a particular window or I can add as many windows as I want and include them in the diff. And it's free.
      If you want to try out vim, you can just type "vimtutor" on the command line and it'll give you the basics on how to move around. My next step was to do ":help" and scroll down to "Getting started" and it has a user manual that goes through the basic features of vim. Once you're done with that you can install some plugins to really get some powe, like fugitive, which will make handling git so much more convenient. I made some videos on vim tips if you want to get a feel for how vim works

  • @jasondelacruz5331
    @jasondelacruz5331 Před 5 lety +5

    This is great! Would love to see it display the keystrokes tho!

  • @rakuteno
    @rakuteno Před 3 lety

    You saved my afternoon! Thanks!

  • @princebhanwra11
    @princebhanwra11 Před 7 lety +4

    wonderfully explained Chong.. thanks!

  • @sosakx
    @sosakx Před 6 lety

    thank you mate, very helpfull!!!

  • @arman1372
    @arman1372 Před 8 lety +2

    Are you using a specific oh my zsh theme? It looks fantastic

    • @ChongKim
      @ChongKim  Před 8 lety +1

      +arman1372 I am using "robbyrussell" theme in oh-my-zsh with powerline (github.com/carlcarl/powerline-zsh). You'd also want syntax highlighting on your shell with colorize and zsh-syntax-highlighting. It's also good to have colored-man-pages when you look up man pages.

  • @josekj1189
    @josekj1189 Před 3 lety

    thank-you very helpful content

  • @lilleyte
    @lilleyte Před 9 lety +2

    Nice tutorial. Vim as a mergetool is pretty impossible without knowing how to enable and disable diff highlighting for various panes. The text color change was also new to me. While I was already able to use vimdiff for two files, now I'm willing to give it a whirl as my mergetool.

  • @bhartimahani2546
    @bhartimahani2546 Před 7 lety

    Hi Chong, If there are 4 files with conflict, and I resolved the first conflict, then how to jump to the next file having comflict. I just did diffu after first was resolved. Now what?

    • @ChongKim
      @ChongKim  Před 7 lety +2

      You save and quit out of vim. You can either :wq multiple times (or ZZ), or you can do it all in one go with :wqa. If git sees there are more files to resolve, then it will bring up another vimdiff session.

    • @bhartimahani2546
      @bhartimahani2546 Před 7 lety

      Ok thanks I will try that way.

  • @andreashurling6995
    @andreashurling6995 Před 3 lety

    When working with textfiles you sometimes need both changes from LOCAL and REMOTE.
    Is it possible to get this done with diffget?

    • @ChongKim
      @ChongKim  Před 3 lety +1

      You can't do it with diffget, but you can just modify the merged text. If they don't conflict, you don't need to do anything because it would include both. If they do conflict, that means that there are some common changes, so you need to figure out how the end result should look like. Using vimdiff 3-way you can see what each change is trying to do. You can't blindly add both since it may change the logic.

    • @andreashurling6995
      @andreashurling6995 Před 3 lety

      @@ChongKim Thx!

  • @kipsta1993
    @kipsta1993 Před 3 lety

    good job

  • @rishabhbhatnagar6795
    @rishabhbhatnagar6795 Před 5 lety

    I'm not getting no working file.

  • @tuliashuliva2646
    @tuliashuliva2646 Před 3 měsíci

    You underestimate just how much the user doesn't know. The user isn't able to even navigate between the three different views and highlight/copy/paste the test, and has no idea what you're doing to do that.

    • @ChongKim
      @ChongKim  Před 3 měsíci

      I have some other videos that go over some basic stuff about vim. This video is pretty specific with what it's trying to do. It's pretty important because it has some capabilities that other merge conflict programs don't have (like seeing the ancestor version that both diffs). I figured that if anyone is trying to do a merge conflict is already familiar with the basics since it means they're working on a large project with out people.

  • @camillesergi1
    @camillesergi1 Před 6 lety

    Why can't I delete or write into the working window?

    • @ChongKim
      @ChongKim  Před 6 lety

      Could you give more info? You should be able to. It's probably unrelated to vimdiff.

    • @camillesergi1
      @camillesergi1 Před 6 lety

      Chong Kim Thank you for getting back quickly! I was just having difficulty navigating between the windows and then back again to the command line within the vim. I used :diffo l, and then i to edit the working screen. Then, I hit esc to return to the vim command line. I hope I'm explaining correctly. I'm new :^) Thank you so much for this video!

    • @ChongKim
      @ChongKim  Před 6 lety +2

      If you're having problems navigating, you might want to try vimtutor on the command line. It will guide you through the basic commands. Then when you have the basics, you can do :help inside vim, and scroll down until you see "USER MANUAL". Follow those links (looks like usr-01.txt) by doing Ctrl-]. I read one or two per day to learn something new every day.
      BTW, if you're in command-mode, you need to type i to get into insert mode.

    • @ericmink
      @ericmink Před 6 lety

      to switch between the windows, you can (in normal mode, so press Esc if you aren't) press CTRL+W followed by either some movement (like h, j, k, l) or again CTRL+W

  • @laravel5argentinacode526
    @laravel5argentinacode526 Před 7 lety +1

    ????????????????????????????????

  • @InterCity134
    @InterCity134 Před 8 lety +1

    Wow, vimdiff, a GUI diff tool you still have to remember command line stuff for, and looks like DOS applications from 1990. For the hard core living 25 years in the past programmer.

    • @vadymmotsukh6403
      @vadymmotsukh6403 Před 4 lety

      the main think with vim that is a speed, but yeah it can be not easy to start with.
      well, about 90-s and current merge tool. Generally nothing changed. Problem is not in a tools, problem in person who writing code.