Resolve Git Merge Conflicts with Neovim and Fugitive!

  Рет қаралды 39,622

DevOps Toolbox

DevOps Toolbox

Күн бұрын

Пікірлер: 109
@devopstoolbox
@devopstoolbox 2 жыл бұрын
If you want them, my dotfiles are here: github.com/omerxx/dotfiles Feel free to subscribe :) www.youtube.com/@devopstoolbox?sub_confirmation=1
@chriswolf4715
@chriswolf4715 Жыл бұрын
I didn't realize you could view your commits and preview the diffs with Telescope! Learned something new today! Thanks!
@avimehenwal
@avimehenwal 2 ай бұрын
Wow, I never knew nvim can do that in the first place. Good to learn from experts like yourself
@dieduch
@dieduch Жыл бұрын
Thanks, this was a really nice and concise demo! Was looking for something like this.
@annusingh4694
@annusingh4694 2 жыл бұрын
Your videos are packed with a lot ammo (info). Thanks!
@艾曦-e4g
@艾曦-e4g 5 ай бұрын
I can not find a better tool than fugitive to do the 3-way merge. Have you ever tried neogit or diffview can do that? If it can, it my left fugitive and move to full lua config. Thank you!
@devopstoolbox
@devopstoolbox 5 ай бұрын
I still consider fugitive the best when it comes to that just like you mentioned!
@rdforte
@rdforte Жыл бұрын
Great vid. What are you using to make your bash prompt look like that?
@devopstoolbox
@devopstoolbox Жыл бұрын
Thank you! My prompt used to be oh-my-zsh but I’ve since moved to starship. It’s lighter and easier to configure! You can find videos covering both on the channel and my config is always available here - dotfiles.omerxx.com
@rdforte
@rdforte Жыл бұрын
@@devopstoolbox awesome thanks!
@NicolasRuizX
@NicolasRuizX 10 ай бұрын
The only reason why I still use vscode to resolve conflicts is because this doesn't let you pick both changes, most of the conflicts that I have working on a large company is when git is stupid and I really need both changes to then refactor some code. If it wasn't for that I would've uninstall vscode ages ago. If you have a solution please share. Nice content btw love your channel
@devopstoolbox
@devopstoolbox 10 ай бұрын
I agree. Maybe lazy git can be a solution, specifically its Neovim plugin that integrates it in. Thanks for the kind words!
@ascourter
@ascourter Жыл бұрын
Great video! I found that when viewing Git log you can hit O to open the diff in a new tab or o to open it in a new split.
@devopstoolbox
@devopstoolbox Жыл бұрын
Nice!!! Thanks 🙏🏽
@surajthakkar
@surajthakkar 2 жыл бұрын
Loving all these videos….please dont stop posting
@devopstoolbox
@devopstoolbox 2 жыл бұрын
Thank you brother!! This kind of feedback keeps me going!
@freekaleek12100
@freekaleek12100 5 ай бұрын
Hey, I’m hoping you’ll pick this up as know it’s an old video - but how do you get options on tab complete when using the ‘diffget’ command? I don’t seem to get tab complete for a file when on the nvim command line and if I do it without I get an error saying there are more than two buffers open. Using ‘d2o’ or ‘d3o’ seems to work but would like to understand how to get the options if possible.
@devopstoolbox
@devopstoolbox 5 ай бұрын
Indeed strange, tab completion should be given to you once you run it in vim. Make sure you have a relatively updated version and that you add a blank space after the command before hitting tab
@freekaleek12100
@freekaleek12100 5 ай бұрын
@@devopstoolbox thanks! Not sure what’s going on. I’m am indeed on a recent version of nvim. Shot in the dark but are you using any specific vim command line cmp plugins?
@adics
@adics 9 ай бұрын
How about I want to take some line of changes from target branch and feature-branch (usually called 'take both')
@chenle02
@chenle02 2 жыл бұрын
Very nice content! What is your tool to show keystrokes?
@devopstoolbox
@devopstoolbox 2 жыл бұрын
Thanks! I use github.com/keycastr/keycastr
@RafaLeyvaRuiz
@RafaLeyvaRuiz 6 ай бұрын
How do you deal with combinig changes from both versions?
@israelssantanna
@israelssantanna 2 жыл бұрын
Thanks for the video! I personally use lazygit, it is very very useful and simple to use! Have you try it yet?
@devopstoolbox
@devopstoolbox 2 жыл бұрын
Hi! Yes I have, on one hand you're still in the CLI, so that's nice and it's a cool helper! On the other hand there's something very flowing about having git commands right from the code where you actually do the work. So I've seen people integrate the shortcuts into LazyGit on top of a plugin like FlowTerm, which is pretty neat. However, this still means I have to use an external "UI" (even if in the terminal) and learn it's intricacies. That's not always bad, and it does provide visual ways to view diffs but personally I found it to be an overhead rather than something that simplifies my work. Would love to hear other thoughts though :)
@deadlysquad13
@deadlysquad13 2 жыл бұрын
@@devopstoolbox As for me, just as you said flowterm saves the day. However, it's still far from 'integrated' feel: even though mappings are vim-like, UI as a whole doesn't follow vim ideologies. You jump between windows differently. You can't move these windows like you do in vim. You don't have normal mode while writing commit message. Compare it with how DAP was designed and flaws become transparent. It's still a good designed tool so I highly recommend trying it out)
@devopstoolbox
@devopstoolbox 2 жыл бұрын
@@deadlysquad13 I missed whether you’re referring to lazy git or fugitive:) About the lazygit - I agree, that’s why I’m all in on fugitive personally but can very much understand lazygit on flowterm users
@deadlysquad13
@deadlysquad13 2 жыл бұрын
@@devopstoolbox Yep! About lazygit.
@MrChickenpoulet
@MrChickenpoulet 2 жыл бұрын
ah didn't know fugitive could also help with conflicts, even after using it for years :D I'd like to suggest to use the `:G` command instead of `:Git`, find it faster as it's two keystrokes less (and is available by default)!
@devopstoolbox
@devopstoolbox 2 жыл бұрын
See?? Here's something I didn't know just as well :) Thanks mate! Definitely nicer, less keystrokes = happy vim user!
@VioletJewel1729
@VioletJewel1729 Жыл бұрын
I remap g to :Git and leader for me is and I also remap to so I don't get annoyed
@cagataykaydr3015
@cagataykaydr3015 Жыл бұрын
@@VioletJewel1729 New line of remap in my config file thanks to you! It was really annoying when I press but do nothing. Especially at the end of the line, it goes to the next line and I cry while screamin'
@VioletJewel1729
@VioletJewel1729 Жыл бұрын
@@cagataykaydr3015 excellent. backspace is the opposite of space in (vanilla) vim. also k$ is easy enough to type to get back to where you were
@iduran
@iduran Жыл бұрын
Nice videos. Thanks! Do you have a video on your keyboard or can you share which keyboard you are using.
@devopstoolbox
@devopstoolbox Жыл бұрын
Thanks mate! I'm using the HHKB (amzn.to/3HwJG60) and in the background it's the Nuphy Air60 (amzn.to/3R3M7jz). Both links are affiliate links, so thank you if you choose to use them :) If you have any questions about either fire away :)
@iduran
@iduran Жыл бұрын
@@devopstoolbox Thanks a lot for sharing. Do you have a link as well for the keycaps that you have in your HHKB? 😁
@devopstoolbox
@devopstoolbox Жыл бұрын
@@iduran I wish :) it used to be sold by kdbfans but not anymore. I’m in pursuit after white blank ones now 😉
@iduran
@iduran Жыл бұрын
@@devopstoolbox I understand. That set is very nice though. Thanks again for sharing and looking forward to more videos from you in the future.
@mxaddict
@mxaddict Жыл бұрын
Are you using Kitty on a mac?
@devopstoolbox
@devopstoolbox Жыл бұрын
Used to. The one you’re seeing is iTerm or Alacritty and I’m on Wezterm for the most of the past year
@mxaddict
@mxaddict Жыл бұрын
Noice @@devopstoolbox
@nraw_
@nraw_ Жыл бұрын
Thanks, this was pretty cool! How would you see all the conflicts in the merge? How would you jump in between the conflicted files?
@devopstoolbox
@devopstoolbox Жыл бұрын
Hello! I use different motions to navigate changes, mostly simple ones like through blocks. Regarding files, I normally check the status with G and use telescope to move over. Not aware of a dedicated mapping to move between them while fixing a conflict. Try LazyGit if you’re looking for something more robust
@nraw_
@nraw_ Жыл бұрын
@@devopstoolbox Thanks for the reply! Have you considered something that would preload all the locations of the conflicts into the quickfix and then maybe iterating over them with trouble? Or alternatively, using the git mergetool to open one by one the files that have a conflict?
@devopstoolbox
@devopstoolbox Жыл бұрын
All sound valid ideas, personally I tackle conflicts rearely, especially these days working on a repo of my own. When this problem presents itself again I might have to jump back to your comment thought!@@nraw_
@burgerk3319
@burgerk3319 Жыл бұрын
what terminal do you use?
@devopstoolbox
@devopstoolbox Жыл бұрын
I switch around 😉 in this video it’s iTerm, my daily driver used to be Alacritty, in the past month though, I’ve been getting used to Wezterm
@ishaankapoor933
@ishaankapoor933 Жыл бұрын
How do you record them in this fashion, I mean having a semitransparent terminal with bg video
@devopstoolbox
@devopstoolbox Жыл бұрын
Hi! There are multiple ways, one of them is to just layer them one on top of the other with your favorite video editing software
@ishaankapoor933
@ishaankapoor933 Жыл бұрын
@@devopstoolbox Thanks, but that would make the text on the terminal/nvim transparent too, right?
@devopstoolbox
@devopstoolbox Жыл бұрын
@@ishaankapoor933 a bit yes. There are also different setups for layering based on the colors so that the important bits don’t get faded
@ishaankapoor933
@ishaankapoor933 Жыл бұрын
@@devopstoolbox damn, thanks
@Yuri-cx9bx
@Yuri-cx9bx Жыл бұрын
How do u select only specific lines and not full chunk.
@devopstoolbox
@devopstoolbox Жыл бұрын
Hmm you mean a line within a hunk? That’s a good question. Never bothered searching for a solution bc I don’t think it made sense but I will search
@Yuri-cx9bx
@Yuri-cx9bx Жыл бұрын
Yes, there are such cases. For example merge conflict where you want to pick only some lines from each version. Also sometimes working on feature making granular commits keeping local prints, todo comments etc... that you don't want to commit but you want to keep them while you working on feature @@devopstoolbox
@dominiquekostler238
@dominiquekostler238 Жыл бұрын
A video on git rebase would be nice :)
@devopstoolbox
@devopstoolbox Жыл бұрын
Ok! Challenge definitely accepted but I need to think about it 😆
@dominiquekostler238
@dominiquekostler238 Жыл бұрын
@@devopstoolbox Eagerly waiting :D
@lintaoamons5712
@lintaoamons5712 2 жыл бұрын
How to get the nice difference colour
@devopstoolbox
@devopstoolbox 2 жыл бұрын
Hey man! This is basically part of your color scheme, you can use mine or others to your liking :) Here’s a cool one I’ve been trying on and off but not yet sure of: github.com/catppuccin
@lintaoamons5712
@lintaoamons5712 2 жыл бұрын
@@devopstoolbox I use the same color scheme, and finally figured out why mine was not showing the color correctly. Because of the tmux setting...
@devopstoolbox
@devopstoolbox 2 жыл бұрын
@@lintaoamons5712 please do share if you have time 😊
@boredseason
@boredseason Жыл бұрын
What do you do if you want both changes from HEAD and the merge branch?
@devopstoolbox
@devopstoolbox Жыл бұрын
Hmmm this feels like an anti-pattern. Since both changes are conflicting you either want one or none… both of them will require manual work to play together. In which case the merge tool doesn’t help. I hope I got your case right, and that I made sense…
@gentashandi
@gentashandi Жыл бұрын
@@devopstoolbox It happens when you rebase or pull to new origin/dev, and the other developer already add their feature name in navigator list. So you need to and their code, then add yours to the same file (navigator list). In that case I need to it manually?
@hugobsb27
@hugobsb27 Жыл бұрын
@@gentashandi .
@chriswolf4715
@chriswolf4715 Жыл бұрын
I find this situation to be pretty rare but it does happen. In that case, I find just deleting the merge conflict "markers" in the file to be the simplest way to do this.
@andersonlavor
@andersonlavor Жыл бұрын
Git over jetbrains ide is a breeze compared to this. I’m a vim person, but this is nightmare. Sometimes you have more complex changes and this flow there is a no go. The only thing I still keep jetbrains around is the features.
@devopstoolbox
@devopstoolbox Жыл бұрын
Well, I guess that's one opinion. I'm a happy Fugitive user and have been for years :) including complex scenarios like the one in the video, but also rebasing (coming out soon) and other potentially complex processes. I might also suggest that trying it long enough will get you settled in.
@JordanBuildz
@JordanBuildz Жыл бұрын
Lol all the times I closed a PR just to open a new one to copy over all my changes..... "feelsbad"
@devopstoolbox
@devopstoolbox Жыл бұрын
Oh I feel your pain buddy!!
@Guilherme-qk9so
@Guilherme-qk9so 2 жыл бұрын
good stuff!
@devopstoolbox
@devopstoolbox 2 жыл бұрын
Thank you!
@ordinarygg
@ordinarygg 2 жыл бұрын
Seems very slow just to merge this small diff, if you have 200 conflicts it will take eternity
@devopstoolbox
@devopstoolbox 2 жыл бұрын
Hmm, I’d argue that if you have 200 conflicts something’s inherently wrong with the process. That said, if I’d ever encounter a 200 conflict scenario, one that I can’t just run “merge -theirs” or “merge -ours” I would much rather have an interactive way of making these selections..
@ordinarygg
@ordinarygg 2 жыл бұрын
@@devopstoolbox you don't work with huge codebases then, with more then +400 people on it, this is quite norm in gaming industry, when some team mess with branch and you will merge your changes because your feature is big. There are no "microservices" pattern thanks god, I would take all day long merging conflicts instead of resolving interdependent "micro-service" web monolith that building most of teams right now, one two services down, whole thing down lol. Nothing special. For all game devs, what web-devs do is sandbox basically in terms of complexity)
@devopstoolbox
@devopstoolbox 2 жыл бұрын
@@ordinarygg I see your point, and I don’t think I can help, I’m sorry you have do deal with such crazy conflicts. Maybe lazygit is more suitable for this kind of work
@ordinarygg
@ordinarygg 2 жыл бұрын
@@devopstoolbox "I’m sorry you have do deal with such crazy conflicts." this is just regular AAA game-dev, no need to sorry)
@devopstoolbox
@devopstoolbox 2 жыл бұрын
@@ordinarygg good luck then brother :)
@PaulMason99
@PaulMason99 Жыл бұрын
Content is good but why add the music and the sound of typing? It's distracting.
@devopstoolbox
@devopstoolbox Жыл бұрын
Thank you brother! Would you rather have a silent video with voice only? I feel like the music and typing and helping with the overall enjoyment of watching. It’s interesting to ask other followers
@PaulMason99
@PaulMason99 Жыл бұрын
@@devopstoolbox Yes for me personally just the voice is what I want.
@devopstoolbox
@devopstoolbox Жыл бұрын
@@PaulMason99 got it! I’ll run a quick poll this week, this is an interesting point. Thanks!
@ShanyGolan
@ShanyGolan 2 жыл бұрын
easier if the developer of fugitive would add icons to pick from left/right like in intellij
@devopstoolbox
@devopstoolbox 2 жыл бұрын
I don’t think Is ask Tim Pope to add icons 😂. Fugitive is much older than Vim and Neovims visual capabilities:) However, the nice thing is you can add mappings for the get / put commands as you like. I encounter conflicts once a week or two so I don’t bother with keymaps
@ShanyGolan
@ShanyGolan 2 жыл бұрын
@@devopstoolbox time to refresh the plugin lol
@yumbuboyumbubo8230
@yumbuboyumbubo8230 2 жыл бұрын
@@ShanyGolan What prevents you to do it yourshelf and make a PR? Great way to learn a new thing, make something usefull and contribute to an Open Source project.
@ShanyGolan
@ShanyGolan 2 жыл бұрын
@Yumbubo Yumbubo true. But I'd have to have deeper understanding of neovim api. I did make a plugin. But need more knowledge base.
@idopshik
@idopshik Жыл бұрын
Oh, you're super.
@avi7278
@avi7278 Жыл бұрын
This workflow is pretty convoluted. lazygit is so much easier...
@devopstoolbox
@devopstoolbox Жыл бұрын
Different strokes for different folks 😉
@user-ot1dv6ri4f
@user-ot1dv6ri4f 3 ай бұрын
That music in the background is really distracting
@wwnnbb9482
@wwnnbb9482 Жыл бұрын
Merging in neovim the most friking complicated thing ever, completely different loser league compared to vscode.
@devopstoolbox
@devopstoolbox Жыл бұрын
I beg to disagree but this is personal taste :)
@PaladinJenkis
@PaladinJenkis Жыл бұрын
Another HHKB bro, your spacebar direction is wrong :D
@devopstoolbox
@devopstoolbox Жыл бұрын
Haha it's not wrong! Yours is 😂 A friend suggested I try it and I never looked back. Think about how your thumbs are pointed from the opposing end of the space bar and it'll start making sense :)
@PaladinJenkis
@PaladinJenkis Жыл бұрын
@@devopstoolbox Yeah it's less harsh on the thumbs, especially if you don't use a wrist rest. Thanks for the video though!
@devopstoolbox
@devopstoolbox Жыл бұрын
@@PaladinJenkis I generally use both, I think it took some adjusting bc of muscle memory but it’s perfect now ☺️ And of course! Thanks for watching and taking the time to share your feedback!
@sspaeti
@sspaeti Жыл бұрын
Thanks for sharing. Love the Takuya (@devaslife) style videos 🤩.
@devopstoolbox
@devopstoolbox Жыл бұрын
Thank you! And yes! Takuya is my inspiration and his style is perfect. I’m just a student 😉
Git Worktrees and Neovim: A Match Made in Coding Heaven
9:53
DevOps Toolbox
Рет қаралды 33 М.
The Holy Grail of Neovim Git Integrations
13:28
DevOps Toolbox
Рет қаралды 46 М.
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
Hilarious FAKE TONGUE Prank by WEDNESDAY😏🖤
0:39
La La Life Shorts
Рет қаралды 44 МЛН
Git MERGE vs REBASE: The Definitive Guide
9:39
The Modern Coder
Рет қаралды 137 М.
The HIDDEN Git Trick for Resolving Merge Conflicts
8:48
DevOps Toolbox
Рет қаралды 21 М.
SPEED UP your Vim navigation skills!
7:15
DevOps Toolbox
Рет қаралды 52 М.
I'm never using Git the same way again
11:19
typecraft
Рет қаралды 99 М.
The Holy Grail of Neovim Note Taking
14:38
DevOps Toolbox
Рет қаралды 365 М.
The Ultimate Database Control. Right WITHIN NEOVIM
9:35
DevOps Toolbox
Рет қаралды 63 М.
Vim Motions & Tricks I Wish I Learned Sooner
9:25
Henry Misc
Рет қаралды 56 М.
How to Vim in 2023: Tips and Tricks
15:53
ThePrimeagen
Рет қаралды 448 М.
This Neovim "Plugin" Replaces 40 Others
15:46
DevOps Toolbox
Рет қаралды 25 М.
Stow has forever changed the way I manage my dotfiles
8:09
Dreams of Autonomy
Рет қаралды 280 М.
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН