Git Tutorial 9: Diff and Merge using meld
Key Takeaways
Teaches how to use meld to resolve merge conflicts in Git
Full Transcript
hello friends in this tutorial we are going to learn how to do this and merge using a tool called meld in git and here is the list of items for this tutorial let's first begin by installing Mel for this are just type in download Mel in Google and click on this first link mail merge dot org is the website here click the link for the download so I have Windows and I am going to install it using Mel installer here click on download button and it will begin the download okay so it's downloading the file here okay my download is over and I have this file here so just double click here to run the installation just click on next next neck and install it my installation is complete and you can see that it put the installation into this C program files melt directory okay so this is where I have this program installed now what I'm going to do is show you the git repository that I have here I have this C code hungry repository where I have a hungry dog py file and if you look at that file this is how the file looks and on github the files looks like this so basically I have added these two new commits to the file if you compare these two you will see these two are the extra lines that I have added and if I do get flogged you will see those two lines were added through this commit now let's see how to run get lift to command to see the difference so first we are going to see the difference between this upstream which is github and our local repository in order to do that you had to run git diff tool origin master origin master here miss github then you do that here it is saying that launch vm disk so we install meld but we have not configured meld yet that's why it is using some default tool that comes with get installation if you do yes then it will show you the difference like this now when leaf looks like a UI from 80s it looks like jaws okay it shows you the difference that this is a new file you added these two lines but it's not doesn't look very nice doesn't look modern basically okay and that's the whole reason why we want to use Mel so in order to use Mel first you need to configure it now to configure it you need to go to see users your directory so I am laundry user and here you will find a git config file if you open gate config file you have only this thing ok now you need to add a couple of lines here so I am just going to copy paste from here so you need to add these three lines in order to configure melt first line says that for lift you are using a tool called meld now what does meld mean so mal means go to this path and fetch the exe we previously saw that this is the directory where mal was installed so you want to supply the same directory name okay and the third one is diff token false meaning don't give me this kind of prompt whenever I say git diff tool always launch mal so let's try this out now when I do this it's going to launch Mel and Mel is a nice-looking UI where you see a cord on the left side this is your upstream and this is your local code okay are so now here there is an extra line okay so it looks like there is some problem let me do get pull real quick to pull whatever changes I have up on upstream and it's going to merge and when I do get diff - now I will be seeing the correct depth okay so the correct diff as you can see here I don't have those two lines versus in my local file I have these two lines so so let me just adding my windows so that you can see the difference clearly okay so this is what I have on upstream so see this is what I have an upstream so on the left side this is github pour this is my local code where you can see this extra two lines okay so this is how you see the difference between your local and op strings now if you make any further chain and let's say you did not commit it then there is a way to see that change as well so for example here now I am adding a new line call and hungry equal to you let's say I add this line okay and then when I do get status I see this file is changed now I can just simply then get lift to get diff tool they show the change between your uncommitted changes in your head so your head doesn't have this and your local changes has that okay so that's why it is showing how okay now let's say if you have multiple different stalls and you want to launch a specific tool for example rims if some people like them differ even though it is old then to launch that you can always use minus T option and give the name of the tool - t means - then this so use vim diff for this one it will launch him death you can also use meld so mad so this way by giving - the option you can launch different tools okay now we are going to look into how to resolve conflicts or how to merge conflicts okay so now let me make some changes locally so locally I have this chain all right and I'm going to commit this change so let me just commit this chi and I will say added Bo okay so this is what I have locally now someone else can go to this repository and they can make a change so let's say they added Y okay and I'll just stay added why now what happened is my local repository and my upstream got out of sync here I have this stuff but locally I have hungry equal to you so they are at the same location but they are different chord changes now when I do get cool so that before pushing the changes you always want to do get full so that you can always get the latest copy from the upstream when I do that it is telling me now that there is a merge conflict you see here much conflict because we both made a change at the same same location okay and if you open your file now it looks really messy you'll be worried what happened to your file so what this is saying is your head has this head with your local change but your upstream has this now obviously you can manually edit this and you can let's say it choose which gene you want to keep let's say you want to keep upstream change which is this then you can just remove these lines and manually edit it but it's not very convenient if you have so many changes so for that you need to run merge tool now before you run merge tool you have to again configure your merge tool in your git config file and to configure your merge tool you need to add these three lines okay here it is saying that for merge use this tool called Mel and again the for the Mel we have specified the path so that get knows from where to launch that tool and also there is an option to not keep backup files if you keep backup files is going to create so many new files in your code repository and it's going to confuse you so I recommend you add this option alright once you have added this option in your kit country now I'm going to launch git merge tool so just run git merge tool come on so remember you are in a merging stage here and at that point you are running git merge tool ok so in the middle you're seeing your local file which is here CC code hungry hundred-watt py on the left you have your local changes like before it showed these merge conflicts these were your changes and these were changes from the upstream now you can decide which in change you want to keep so for example let's say I like the upstream change I want to keep it so you can click on this little arrow here ok once you do that what its gonna do is it's gonna remove everything else and keep this one and if you didn't like that alright so let me just close it and cancel it ok close it and say close without saving and again launch the same command basically let's say I wanted to keep my chain instead of abstention in that case you would have clicked this arrow and it will keep your change okay so I can do undo so you can do unknown or do undo and then you can go to next chain if you have so many changes you can use these arrows you can use this save option there are many useful options in this area okay I decided to use my upstream chain so I'm going to click on this arrow okay and hit save and hit cancel okay at this point I have some local changes so I can just say git commit - M most conflicts so I just successfully merged conflicts okay at this stage now my repository status is clear now it is master from merging and I can now push my commit so when I do push is gonna update the upstream and upstream now has both of these changes plus it has this new okay so that was all about how to use a med for deferring the changes and also for merging the changes I have used mal uh for quite some time it is very very user friendly so I would recommend you to use the same tool alright thanks for watching and we'll see you in the next tutorial
Original Description
This git tutorial covers (1) How to install meld (2) Run meld using git difftool command to see diff (3) Use git mergetool command to use meld to resolve merge conflicts.
Do you want to learn technology from me? Check https://codebasics.io/ for my affordable video courses.
Git Tutorial: https://www.youtube.com/watch?v=xAAmje1H9YM&list=PLeo1K3hjS3usJuxZZUBdjAcilgfQHkRzW
Next Video:
Git Github Tutorial 10: What is Pull Request?: https://www.youtube.com/watch?v=e3bjQX9jIBk&list=PLeo1K3hjS3usJuxZZUBdjAcilgfQHkRzW&index=10
Machine Learning Tutorial With Python: https://www.youtube.com/watch?v=gmvvaobm7eQ&list=PLeo1K3hjS3uvCeTYTeyfe0-rN5r8zn9rw
Website: https://codebasics.io/
Facebook: https://www.facebook.com/codebasicshub
Twitter: https://twitter.com/codebasicshub
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from codebasics · codebasics · 51 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
▶
52
53
54
55
56
57
58
59
60
Python Tutorial - 1. Install python on windows
codebasics
Python Tutorial - 2. Variables
codebasics
Python Tutorial - 3. Numbers
codebasics
Python Tutorial - 4. Strings
codebasics
Python Tutorial - 5. Lists
codebasics
Python Tutorial - 6. Install PyCharm on Windows
codebasics
PyCharm Tutorial - 7. Debug python code using PyCharm
codebasics
Python Tutorial - 8. If Statement
codebasics
Python Tutorial - 9. For loop
codebasics
Python Tutorial - 10. Functions
codebasics
Python Tutorial - 11. Dictionaries and Tuples
codebasics
Python Tutorial - 12. Modules
codebasics
Python Tutorial - 13. Reading/Writing Files
codebasics
How to install Julia on Windows
codebasics
Python Tutorial - 14. Working With JSON
codebasics
Julia Tutorial - 1. Variables
codebasics
Julia Tutorial - 2. Numbers
codebasics
Python Tutorial - 15. if __name__ == "__main__"
codebasics
Julia Tutorial - Why Should I Learn Julia Programming Language
codebasics
Python Tutorial - 16. Exception Handling
codebasics
Julia Tutorial - 3. Complex and Rational Numbers
codebasics
Julia Tutorial - 4. Strings
codebasics
Python Tutorial - 17. Class and Objects
codebasics
Julia Tutorial - 5. Functions
codebasics
Julia Tutorial - 6. If Statement and Ternary Operator
codebasics
Julia Tutorial - 7. For While Loop
codebasics
Python Tutorial - 18. Inheritance
codebasics
Julia Tutorial - 8. begin and (;) Compound Expressions
codebasics
Python Tutorial - 12.1 - Install Python Module (using pip)
codebasics
Julia Tutorial - 9. Tasks (a.k.a. Generators or Coroutines)
codebasics
Julia Tutorial - 10. Exception Handling
codebasics
Python Tutorial - 19. Multiple Inheritance
codebasics
Python Tutorial - 20. Raise Exception And Finally
codebasics
Python Tutorial - 21. Iterators
codebasics
Python Tutorial - 22. Generators
codebasics
Python Tutorial - 23. List Set Dict Comprehensions
codebasics
Python Tutorial - 24. Sets and Frozen Sets
codebasics
Python Tutorial - 25. Command line argument processing using argparse
codebasics
Debugging Tips - What is bug and debugging?
codebasics
Debugging Tips - Conditional Breakpoint
codebasics
Debugging Tips - Watches and Call Stack
codebasics
Python Tutorial - 26. Multithreading - Introduction
codebasics
Git Tutorial 3: How To Install Git
codebasics
Git Tutorial 1: What is git / What is version control system?
codebasics
Git Tutorial 2 : What is Github? | github tutorial
codebasics
Git Tutorial 4: Basic Commands: add, commit, push
codebasics
Git Tutorial 5: Undoing/Reverting/Resetting code changes
codebasics
Git Tutorial 6: Branches (Create, Merge, Delete a branch)
codebasics
Git Github Tutorial 10: What is Pull Request?
codebasics
Git Tutorial 7: What is HEAD?
codebasics
Git Tutorial 9: Diff and Merge using meld
codebasics
Difference between Multiprocessing and Multithreading
codebasics
Python Tutorial - 27. Multiprocessing Introduction
codebasics
Python Tutorial - 28. Sharing Data Between Processes Using Array and Value
codebasics
Git Tutorial 8 - .gitignore file
codebasics
Python Tutorial - 29. Sharing Data Between Processes Using Multiprocessing Queue
codebasics
Python Tutorial - 30. Multiprocessing Lock
codebasics
Python Tutorial - 31. Multiprocessing Pool (Map Reduce)
codebasics
What is code?
codebasics
Python unit testing - pytest introduction
codebasics
Related AI Lessons
⚡
⚡
⚡
⚡
Data Preprocessing: Encoding and Feature Scaling in Machine Learning
Medium · Machine Learning
Data Preprocessing: Encoding and Feature Scaling in Machine Learning
Medium · Data Science
The Python Dictionary Trick That Makes Interviewers Smile
Dev.to · Ameer Abdullah
I Compared 50 Python Courses. Here Are My Top 5 Recommendations for 2026
Medium · Python
🎓
Tutor Explanation
DeepCamp AI