 Let's talk a few about version control today. Yeah, I call it also your project safety net. First of all, it's maybe my phone. So first of all, yeah, version control. I want to back to know my audience. Who of you has ever heard of version control? Who of you is using version control every day or sometimes, okay, quite a few. Okay, for these people, yeah, I want to talk about version control, maybe also some aspect which you might not have known yet. And for everyone else, let's try to figure out what version control actually is and how it can be useful to you in your projects. Okay, so I've been working on my computer today and other days as a software developer and doing that in teams with different people, working on projects, working on many files in many different folders and there it can get messy. But there's one thing which helped me all the way along and this is version control and today I want to show you how it can help you as well. Good, so let's take a look at some project which we might start first on our own and then later, so together with other people and we've got some folders in there, we've got some files, also got some images. That's like just an example, small project, yeah. And we then in this case, sorry, I have to turn my hand like that, and yeah, so we have this project and then we might work on one file and go along but say, hey, we still want to keep this one little bit and don't want to delete that because maybe we need it later. So we create a copy of that folder, right? And then we go on and continue and maybe there's something else. We just change one file but we want to keep it. We create a new folder and another one and another one, but this is the last one, right? It's the final version. We will not do any changes after that, right? Yeah, so usually that happens and again and so on and this is just an example I've brought up because actually my personal examples, for example, in Bachelor thesis would be just too embarrassing to show here would be too long. Who of you actually, like things, such a thing might have happened to you as well at some point in your life? Oh, quite a lot of people, right? But the good news is, whenever you did that, you created your own version control system because that actually, you're taking your versions, different versions of your project and somehow control the flow of them. You give names to different versions and somehow have it in some sort of order. But what is, when you want this one little thing out of this one small file, is there any chance to find it again somewhere in all of this mess? Probably not, right? So here's where the version control system comes in there and I call it like a safety net for your project. So you can imagine your project, it's dancing on a line on a circus and you have everything in control but then you forget one thing, the version control is there to save you as your safety net. You fall but the version control system is there. Okay, what is your version control system actually? So it keeps a history of all of your different versions which you worked on in your past and it has a lot of different extra tools for you, this space. Good, who of you knows Google Docs? Right, almost everyone of you. There you can work on one file simultaneously. Like here you see two different people working on the same file at the same point in time but maybe not everyone of you knows about this other, like when you click on top there you can actually get to the version history section of Google Docs. So there you can actually see a history on the right, on the right hand side you see Google Docs is automatically storing different versions of your project where you can go back to and you can then recover stuff. On the left hand side you see different versions of people color highlighted. And that's, maybe you wonder, like I saw online many people really wonder why is there no save button there in Google Docs? There's no save, what? That's because Google Docs is keeping your versions, it's saving it for you. You don't need a save button yourself but there's a version control system behind it. Good, so Google Docs is something cool when you work on one file simultaneously but let's look at something where you can work together with many different people on many different files and many different folders. There you want a version which is local and for that you would have your local folder and you would have some hidden folder in there where your version control system, your safety net is storing all your versions and then you've also got, and here on the right hand side I just show you how it looks like when we do our naive version control approach and now I want to compare the two. So when I start with my first version I can add a name to it, a name how I can remember what they did in this version. And that's like, here the version separately stored and also who did that version. So here I've got a small emoji of an astronaut with a moustache because that's kind of what I dreamt to be at some point. It didn't work out that way but in Google Docs you can also actually give a name to your version and so that's the same way you can do it in a version control system. You can change the dates to names. Good, and then the whole thing comes in kind of a tree because that's how in a version control system all your versions you can imagine of being set along each other in a big tree and growing as you go on and they cannot be changed. So each version builds on the other one that you can change them that's more sophisticated way of using it but we'll stick to that. Okay, now it gets interesting and the second version. And now in the second version I want to include an intro of our cat and now we already see a first difference of in a version control system with just our one folder and the hidden folder VCS stands for version control system so it's the folder holding version control system and on the right hand side we have already two folders because we created a copy and this goes up into the tree and we can create more and more versions and now it's the eighth version and then even someone else could come in. Another person adds a version and changes the files and even another person undoes the change but you've got with all these messages a history of who did what and you see on the right hand side that when you do it naively you've already got a lot of many copies of your project and for example well the images, the image folder they were all copied again and again and the version control system we've got just one folder they add this hidden version control system folder okay, sounds good and the moment we will talk about what's actually inside this version control system folder which holds kind of the magic and how it works that we can have all of this history of versions where we can jump back to and forth without actually having all of these different folders so now even the rock is happy so he can read the messages and come back and forth but let's quickly review let's quickly recap the benefits are so we see that actually with the version control system we can have infinitely many versions but for that we need infinitely many folders and sorry that's when we do it by hand and when we have a version control system we can have as many versions as we want and we just keep this one folder with our project plus this additional version control system folder which we will look at in a moment and then we also see when you copy the files it gets big data-wise and with the version control system you use less this space but there's still you still got all these versions so how does this actually work and what's inside this version control system folder let's take a look how this works who of you does know any working control systems you know any names of them think you were first Git is a famous one anyone know another one yes SVN, subversion so there are some of them these are the three most popular ones so there are a lot of different ones it's actually a big space with a lot of different ones and I put in Google Docs there it's not a version control system but it has one under the hood and we will take a look at Git now that's the most successful and the most widely used one and it got a lot of and you see how popular it is it's called Github that's like a cloud version of it just recently got acquired by Microsoft for a really high price and just shows you how important these systems are good so let's take a look how could that actually work now to save space and all files so instead of copying all of these different folders and when we change just one word in one file you know but we want to keep some of the changes and keep the version we would copy the entire folder in our life approach what if we just only store the changes so we only store there was one word changed and then we change something else and we store only that change and then we change it again we store that change and we don't have to copy entire huge files we only change small bits and in the end we put everything together so that it again makes sense in one file as a version control system sounds reasonable right but that's not what Github is doing can you think of why that might not what could be a downside of that approach any ideas yes exactly so you see it's a really complicated thing to do if you have differences of files and then you have to remember once you deleted everything then you put something back then you change the name and so on and in the end you have to put everything together it's really complicated process and you've never got your real file which is your current version on your system you always first have to compute it so that's why Gith in particular is a version control system chose a different approach to change even a small one we copy this very file but we will never copy all of the other files which you have not of all of the other image files and so on but we can compare very fast whether your new all the files of your new version which ones have you changed and which ones not so how does Github do that alright so for each and every file it's a so called hash it's a representation of just a string of 40 characters of the contents of your file so everything in there gets a hash and with that you can the content is uniquely identified that's not only text that's also every picture every picture gets such a hash in the end you just have to compare hashes so even if you have documents like here in the first letter is different the hash the resulting string is completely different and that's really useful because you then only have to compare the hashes for example if only the last word of your file was changed the version control system has not had to go through the entire 1000 or so lines to check whether the document is different in the new version to the old one it could just compare the 40 characters and see that the document is different so each and every document in your folder receives a hash and for example this is my first version which is all of these hashes and then now I change only this one file this report file here in red and my second version will then get a new hash there but all the other hashes would remain the same so even also all of the folders all of the files would not be copied but just that one would be recreated let's take a look inside the version control system folder and here we see in the first version we've got all of these files in there recreated so actually when you begin your project with a version control system then you have a bit more data and you have double the amount of disk storage of your project but when you copy some file or just change one file only this one file is recreated and not all of the other files which would be done in a naive approach so after you create like the third version already you save disk space and that's especially useful when you share your project or working on it with many different people because many different people put in many different changes it will get a lot of versions and that makes it possible to work effectively ok, so I talked a lot about version control system very theoretically and so on and you must be thinking ok man, Andre but how could I ever use that if I'm not a programmer and raise my hand in the beginning and I have the feeling you're only talking to these guys of people, no graphical user interfaces where you can begin to use version control with any kind of project today and I give you just one example that source tree, I don't want to make any advertising for it, just free software and here you could take any folder of your project and just drag it in there and boom, your project is already version controlled and when you're inside there for example, as I did in the example before, I'm changing only one file this project file and here I'm deleting half of the project because I'm kind of fed up with it no, it was bad, but I might still want to keep this change and use it later, I never know and so this will be my change and the only real important word you need to know now to get going with Git and this one is a commit a commit stands for a new version and so here you see on the top left there's the commit button, when you press that you can also put in a name as you saw before, a name for your version you press commit and that version is saved and with that program, you can always go back to your versions, jump back and forth and then it has a lot of more tools to offer how to work together in a big team and that only in the end makes it even possible for people, for software teams and production projects to be spread around all over the world and to still being able to control exactly what they're doing, to know exactly who did what, where and when to have complete the complete overlook over everything and with kind of having all of this detailed information you think oh no everyone knows exactly what they did no, it actually frees up a lot because you can be spread over a lot and work together effectively okay, thank you very much thank you Andre any questions for Andre about version control there is at the back, do it Mike does it handle hash collisions and if yes then how okay so what is a hash collision and so we have got these hashes as you saw these strings of 40 characters and we saw that I told you they are unique every single document you have gets a unique string but this is an algorithm which tries to do that and does it almost all of the time but not each and every time and then if you have two documents different documents and they turn out to have the same 40 characters string you have a hash collision okay that is just to get everyone first on the page of what this question is about and now the question was does the system actually handle that and what does it do in that case and I must tell you I am not exactly sure how it handles that it happens very rarely and just as an addition to that because it happens so rarely actually you don't almost never on most computer systems you don't have to use the whole length of all of these 40 characters because just a part of that maybe even six or eight of these characters are enough most of the time to uniquely identify all of your different files because there are already millions of different combinations so like you need to try out until you get such a collision maybe another question please anyone right there at the back please one question if you are working with teams will be more recommended to work in the ones like Google, Dogs that already use this kind of algorithm behind or will there be like a certain philosophy using like a software specifically for this recommendation like to use the ones that are like Google Dogs or to download yours and work in files and teams with an algorithm approach okay thank you very good question so for example Google Dogs is really great for working on the same thing simultaneously real time you are all in there working on the same file and it has this mechanism for it which I showed you is you have your project kind of on a server you get your clone your copy of that work on it yourself on your computer and other people work on it as well they can chill work on it and then you put everything together on the server and at that point you might have to resolve conflicts so Google Dogs is a cool way of offering this live simultaneous thing and there are also other tools for that as well so I think that's kind of the main differences difference when you really are there at the same time and can even like add comments live and change that as with Git as you can take it home to your computer work on it and then maybe from even more complex things and then later send it to everyone thank you André, thank you very much Thank you