Git Tutorial 9: Diff and Merge using meld

codebasics · Beginner ·📐 ML Fundamentals ·9y ago

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 Python Tutorial - 1. Install python on windows
Python Tutorial - 1. Install python on windows
codebasics
2 Python Tutorial - 2. Variables
Python Tutorial - 2. Variables
codebasics
3 Python Tutorial - 3. Numbers
Python Tutorial - 3. Numbers
codebasics
4 Python Tutorial - 4. Strings
Python Tutorial - 4. Strings
codebasics
5 Python Tutorial - 5. Lists
Python Tutorial - 5. Lists
codebasics
6 Python Tutorial - 6. Install PyCharm on Windows
Python Tutorial - 6. Install PyCharm on Windows
codebasics
7 PyCharm Tutorial - 7. Debug python code using PyCharm
PyCharm Tutorial - 7. Debug python code using PyCharm
codebasics
8 Python Tutorial -  8. If Statement
Python Tutorial - 8. If Statement
codebasics
9 Python Tutorial - 9. For loop
Python Tutorial - 9. For loop
codebasics
10 Python Tutorial -  10. Functions
Python Tutorial - 10. Functions
codebasics
11 Python Tutorial - 11. Dictionaries and Tuples
Python Tutorial - 11. Dictionaries and Tuples
codebasics
12 Python Tutorial - 12. Modules
Python Tutorial - 12. Modules
codebasics
13 Python Tutorial - 13. Reading/Writing Files
Python Tutorial - 13. Reading/Writing Files
codebasics
14 How to install Julia on Windows
How to install Julia on Windows
codebasics
15 Python Tutorial - 14. Working With JSON
Python Tutorial - 14. Working With JSON
codebasics
16 Julia Tutorial - 1. Variables
Julia Tutorial - 1. Variables
codebasics
17 Julia Tutorial - 2. Numbers
Julia Tutorial - 2. Numbers
codebasics
18 Python Tutorial - 15. if __name__ == "__main__"
Python Tutorial - 15. if __name__ == "__main__"
codebasics
19 Julia Tutorial - Why Should I Learn Julia Programming Language
Julia Tutorial - Why Should I Learn Julia Programming Language
codebasics
20 Python Tutorial  - 16. Exception Handling
Python Tutorial - 16. Exception Handling
codebasics
21 Julia Tutorial - 3. Complex and Rational Numbers
Julia Tutorial - 3. Complex and Rational Numbers
codebasics
22 Julia Tutorial - 4. Strings
Julia Tutorial - 4. Strings
codebasics
23 Python Tutorial -  17. Class and Objects
Python Tutorial - 17. Class and Objects
codebasics
24 Julia Tutorial - 5. Functions
Julia Tutorial - 5. Functions
codebasics
25 Julia Tutorial - 6. If Statement and Ternary Operator
Julia Tutorial - 6. If Statement and Ternary Operator
codebasics
26 Julia Tutorial - 7. For While Loop
Julia Tutorial - 7. For While Loop
codebasics
27 Python Tutorial  - 18. Inheritance
Python Tutorial - 18. Inheritance
codebasics
28 Julia Tutorial - 8. begin and (;) Compound Expressions
Julia Tutorial - 8. begin and (;) Compound Expressions
codebasics
29 Python Tutorial - 12.1 - Install Python Module (using pip)
Python Tutorial - 12.1 - Install Python Module (using pip)
codebasics
30 Julia Tutorial - 9. Tasks (a.k.a. Generators or Coroutines)
Julia Tutorial - 9. Tasks (a.k.a. Generators or Coroutines)
codebasics
31 Julia Tutorial - 10. Exception Handling
Julia Tutorial - 10. Exception Handling
codebasics
32 Python Tutorial  - 19. Multiple Inheritance
Python Tutorial - 19. Multiple Inheritance
codebasics
33 Python Tutorial - 20. Raise Exception And Finally
Python Tutorial - 20. Raise Exception And Finally
codebasics
34 Python Tutorial - 21. Iterators
Python Tutorial - 21. Iterators
codebasics
35 Python Tutorial - 22. Generators
Python Tutorial - 22. Generators
codebasics
36 Python Tutorial - 23. List Set Dict Comprehensions
Python Tutorial - 23. List Set Dict Comprehensions
codebasics
37 Python Tutorial - 24. Sets and Frozen Sets
Python Tutorial - 24. Sets and Frozen Sets
codebasics
38 Python Tutorial - 25. Command line argument processing using argparse
Python Tutorial - 25. Command line argument processing using argparse
codebasics
39 Debugging Tips - What is bug and debugging?
Debugging Tips - What is bug and debugging?
codebasics
40 Debugging Tips - Conditional Breakpoint
Debugging Tips - Conditional Breakpoint
codebasics
41 Debugging Tips - Watches and Call Stack
Debugging Tips - Watches and Call Stack
codebasics
42 Python Tutorial - 26. Multithreading - Introduction
Python Tutorial - 26. Multithreading - Introduction
codebasics
43 Git Tutorial 3:  How To Install Git
Git Tutorial 3: How To Install Git
codebasics
44 Git Tutorial 1: What is git / What is version control system?
Git Tutorial 1: What is git / What is version control system?
codebasics
45 Git Tutorial 2 : What is Github? | github tutorial
Git Tutorial 2 : What is Github? | github tutorial
codebasics
46 Git Tutorial 4: Basic Commands: add, commit, push
Git Tutorial 4: Basic Commands: add, commit, push
codebasics
47 Git Tutorial 5: Undoing/Reverting/Resetting code changes
Git Tutorial 5: Undoing/Reverting/Resetting code changes
codebasics
48 Git Tutorial 6: Branches (Create, Merge, Delete a branch)
Git Tutorial 6: Branches (Create, Merge, Delete a branch)
codebasics
49 Git Github Tutorial 10: What is Pull Request?
Git Github Tutorial 10: What is Pull Request?
codebasics
50 Git Tutorial 7: What is HEAD?
Git Tutorial 7: What is HEAD?
codebasics
Git Tutorial 9: Diff and Merge using meld
Git Tutorial 9: Diff and Merge using meld
codebasics
52 Difference between Multiprocessing and Multithreading
Difference between Multiprocessing and Multithreading
codebasics
53 Python Tutorial - 27. Multiprocessing Introduction
Python Tutorial - 27. Multiprocessing Introduction
codebasics
54 Python Tutorial - 28. Sharing Data Between Processes Using Array and Value
Python Tutorial - 28. Sharing Data Between Processes Using Array and Value
codebasics
55 Git Tutorial 8 - .gitignore file
Git Tutorial 8 - .gitignore file
codebasics
56 Python Tutorial - 29. Sharing Data Between Processes Using Multiprocessing Queue
Python Tutorial - 29. Sharing Data Between Processes Using Multiprocessing Queue
codebasics
57 Python Tutorial - 30. Multiprocessing Lock
Python Tutorial - 30. Multiprocessing Lock
codebasics
58 Python Tutorial - 31. Multiprocessing Pool (Map Reduce)
Python Tutorial - 31. Multiprocessing Pool (Map Reduce)
codebasics
59 What is code?
What is code?
codebasics
60 Python unit testing - pytest introduction
Python unit testing - pytest introduction
codebasics

Related AI Lessons

Data Preprocessing: Encoding and Feature Scaling in Machine Learning
Learn to preprocess data by encoding and scaling features for better machine learning model performance
Medium · Machine Learning
Data Preprocessing: Encoding and Feature Scaling in Machine Learning
Learn to preprocess data for machine learning by encoding and scaling features, a crucial step for model training
Medium · Data Science
The Python Dictionary Trick That Makes Interviewers Smile
Learn the Python dictionary trick that impresses interviewers and improves your coding skills
Dev.to · Ameer Abdullah
I Compared 50 Python Courses. Here Are My Top 5 Recommendations for 2026
Discover the top 5 Python courses for 2026, curated from a comparison of 50 courses, to enhance your programming skills and career prospects
Medium · Python
Up next
Is Python Dead in 2026?| Truth About Python in AI Era | 90 Days Roadmap @FameWorldEducationalHub
FAME WORLD EDUCATIONAL HUB
Watch →