Git Training: Step-by-Step Guide to Git Version Control | Oleksandr Kocherhin | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Git Training: Step-by-Step Guide to Git Version Control

teacher avatar Oleksandr Kocherhin

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

20 Lessons (1h 50m)
    • 1. Introduction

      1:35
    • 2. Git installation

      1:22
    • 3. Email and name configuration

      1:52
    • 4. Initializing git project

      4:49
    • 5. How to see your changes?

      4:47
    • 6. Pushing repo to Github

      6:19
    • 7. Working with branches in git

      6:23
    • 8. Merging branches in git

      5:02
    • 9. Uploading and downloading code from Github

      6:57
    • 10. Correct workflow with git

      6:23
    • 11. Why do you need releases in git?

      2:59
    • 12. Why do you need hotfixes in git?

      3:49
    • 13. Simplifying git workflow with Gitflow

      11:12
    • 14. What are tags in git?

      4:29
    • 15. How to resolve merge conflicts in git?

      6:15
    • 16. How to stash your code in git?

      9:06
    • 17. How to copy your changes?

      3:53
    • 18. Configuring git and git aliases

      8:25
    • 19. My git aliases

      11:07
    • 20. Prettify git with diff so fancy

      2:56
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

36

Students

--

Projects

About This Class

This course starts from scratch, you don't need to know anything about Git or version control systems!

You'll learn all about installing Git, creating commits, working with branches, pushing to Github, merging features, correct workflow, resolving conflicts, writing custom aliases and much more!

And if you do get stuck, you benefit from an extremely fast and friendly support in discussions to the course.

Git is the most popular and powerful version control system nowadays. It allows you to control all your file changes and work as a team.

Learn all the fundamentals you need to know and benefit from them your whole life as a developer!

Specifically you will learn:

  • How to install git

  • How to initialise Git project and adjust basic configuration

  • How to create commits

  • How to check any commit content

  • How to push your code in remote repository on Github

  • What are branches and how to work with them

  • How to merge branches

  • What is the correct workflow with Git

  • What is gitflow and how to use it

  • How to create releases and hotfixes

  • How to create and use tags

  • How to resolve Git conflicts

  • Advanced git commands

  • How to configure git properly

  • How to create own git aliases

Don’t lose any time, gain an edge and start using Git as PRO now!

Who this course is for:

  • Anyone who wants to fully understand Git
  • People who are new to version control system

Meet Your Teacher

I am a full-stack developer with a passion for learning and teaching what I know. I have been programming for around 10 years and teaching for almost 6 years.

I believe in learning through doing and this philosophy is present in every course that I teach. I love exploring new web & mobile technologies and my courses focus on giving you the edge in our fast-moving industry.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: welcome to my course about get. It's so great to heavy here. In this course, we will learn from scratch how to use git, and they serially often hope people are struggling with learning heat or using it correctly . And some of this say that it's fine to just copy the folder every day, and we don't need gate and other adjusting that get is too complicated, but of course it's not if you learn it properly. And from my perspective, get is the single most important tool that any developers should know and use. In this course. We won't use any graphical tools, but only consul commands, which is actually an 80 way off using it. But you should not be scared because it won't be too complicated and basic council skills high enough for this course. Dude in discourse, we will learn the correct workflow off gate, how to work with branches and different states off your code. How to applaud your code in get hub resolved, merge conflicts and much, much more. By the end of this course, you will be able to use get every day for comfortable and safe programming. Who am I? My name is Alexander Kahin, and I'm of every developer with more than 10 years of experience, as well as a professional instructor with various courses about Web technologies. I did my best to put all my knowledge inside this course, and I want to share it with you, so welcome on board and let's get started. 2. Git installation: in this video. I want to go through installation process, off console, get to install it. You can just go to official website. Get SCM dot com And here there is a don't lord button on the right or you can just go on, slash down loans and check your version on my crest. I can recommend brew s package manager to install all your programs. So basically, it's enough to just write in console brew, install gate and this command willing style get completely without need to download anything on windows. It's easier to just don't Lord exact file from this website and install it as any other program on lane looks. For example, or newborn toe. You can use up to get package manager with command, Souder upped. Get in style, get and this will do the same. To check that get was successfully installed on any operation system, you can just open, console and ride get minus minus version. As a result, we should get something like this. Get version 2.20 point one. This means that get was successfully installed and we can move to are the lessons 3. Email and name configuration: first thing that we need to do after installing Gate is to configure, use a email end, user name. Get will use this information later for chametz. And it's really useful when several people are working. Indeed, Toe. Understand who did what to do this. We can just write simple command, get confused. All commands forget where we configure get itself are starting with git config and then we can just say user dot name. And here, Alex, you can write here any name you like. I won't try and this command, because I don't want to override my current settings. The next command that we want to run is user dot email. And here, let's say we want to write test at test dot com. Actually, doesn't matter if this email exists or not, we won't get any confirmation letter or something like this. This is only forget. Let's check what happened after run in thes two commands. For this, we can open file, which is located in our home directory dot git config. Your file should look smaller than mine, but this section in your file was generated by thes two commands, user name and user email. These settings we can just right here on our own or run get conficker Oman's to generate this settings in our file And don't get config in our home directory. This is global configuration. Forget this means that for all projects on off get on our machine, this configuration will be applied. And for now, we just need thes settings to use it in all our projects. 4. Initializing git project: I've just created new empty folder. Consul Geet. This will be our project to Iran and use git commands. The first thing that we need to do here is to say that this performer is under get control and we have get command for these, which is called Get in it. After using this command, we see the message that get initialized empty git repository For us, this means that now we can use git commands in this folder. What exactly get did with command, getting it get created new folder dot gate and put a lot of files for itself there. If we write a less command, we can see that there is in your folder inside, which is called dog Eat. Let's start with using git commands. The most popular get command is get startles. It looks like this. It says that we're on Branch Master and we don't have any commits yet and we don't have anything to commit. I will tell more about branches in next videos. For now, let's create new file. Let's name it one dot Js and we can use touch command to do this. If we check now, what is inside our folder regenerated new file one. Don't. Yes. Let Ron gets totals, Command once again. Now we see that it looks quite different. We have a message that we have untracked files. And here is our file one dot jess Untracked files are files that are not tracked by git. This means that if we change them, get won't know anything about this changes. And this is something to remember here. If our files are read, this means that they're not dragged by. Get how can we had files to get tracking? This is quite easy. There is a special command. Get ad. And here we need to say, what files do we need to add to get trekking? In our case east one dot Jess, we don't get any message in return. But if we will right now and get started again, we can see that our files are not read anymore and they are green. When we create new files, we should not forget toe, add them to get tracking. Then they will be tracked in get history and we can understand all changes that were done in thes files. We can also return toe any state that was in code when it was engaged. History. This means that we can't lose our cold anymore, and we can delete it easily and add new stuff and return to some moments later. Now it's time to commit files that we created. Commit means to fix our changes in get history. After these, we can make any other changes and return to this moment. To do this, we can just tried, get commit minus M and hear his message. For example, we can right here started learning get. And this minus m key means that we don't want to open some editor to write commit message, but we can just do it in line. So basically, when were right minus M and then the stream in quotes? This means that this is in line message for our committee. Commit messages needed to understand. What is it about a tall what did we change in our cold in this specific commit. As a result, we can see that one file was added to this committee, and if we right now, once again get starters, we can see that we don't have anything to commit, as it was in the beginning. Now let's look an hour, commit history and there is a special get command for this. If we're right, get log, then get commit. History will be opened here. We can see that we have only one commit with names started learning get. And here we can see also the author. And this is exactly the information that we feel in our and get conflict previously. Also, we can see when this committee was done, for example, this was done on Wednesday on six off February. Now we see only one commit. But of course, if we have more, we can see the whole least with this command. Now, if we change anything, we can always return to this specific committee because it was fixed in get history. And this is exactly what we wanted with get. We want the stability that we cannot lose our changes 5. How to see your changes?: In this video, we will learn such useful functions in Get like GDF and get Show. But first, let's create some useful function in our file one dot Js that we created previously. There's just open it with any editor and here let's say we want to add a new function which is called At Number and it works with toe arguments A and B and we just want to return a plus B this whole let's save it and difficult right now get status. We see that we have changes that not staged for community. This means that the raw, modified files and get knows that we've changed something. Let's check how gets his our changes. And there is a command called giddy for these. If we will just tried get dif and hit enter we see here modified and the name of the file here and inside the file we see with green collar our function that we're old previously so good dif shows all our changes and for now we have only one file That was my defiant and lines that were added a marked with green color and lines that we deleted a marked with red So now we see on the green lines. Let's commit our changes now like we did in our previous lesson. Because file one dot gs is already tracked. We don't need to write, get at command. But I often had problems that I forgot to add some new files to get, which means I just created them. But they are untracked. That's why I always ride. Get ad and dot This will add all new files that were created to get. So I just simply ride this command. Always tow. Avoid forgetting to push something to fix all our changes. Don't forget that if you don't know in what state you are now, you can always ride, get status and this will show you the status off our files. So for now, we see that one file was modified and it is triggered by get. Now we need to commit our changes. And for these, we can simply right, like we did previously get commit than minus M and the message. And let's make it more understandable. So what we did here, we added add number function. Let's just hit, enter. And as you can see, our commit was created Now if we will write, get log, we can see to commits. Now First committee is from our previous lesson and this commit we have just created when we do more and more commits were often need to check changes in specific committee. And there is a command for this which is called Gitcho, and it is written like this Get show and then the a d off the commit to do this And in our case, we can see in get log The cash is off the committee. Basically, this is our i ds and we can just copulate e from get log and ride, get show and then the head. As you can see, it looks exactly the same. Like it was looking when was old GDF command. Now let's say that we need to do changes and change our add function to deduct function. Let's just open it. And in this file we can simply change, add toe the docked number and then change plus two minus and that's it. If we will just tried to get dif Now we can see that there are lines that a marked with red and these airlines that were deleted and the green lines of what we have added and get drag track all our changes. And it doesn't matter if we change the whole file or just a single symbol for warm clothes anything. So let's now commit our changes toe. Don't forget what we did. So for these, we can just simply right get at. Plus, this won't do anything in this case, but it's just for safety. And now we can ride, get commit minus M. And here, for example, changed. Add to deduct We hit enter and our committee is there. As you can see, it's completely impossible was Geet to lose your cold. So I recommend to use get always, no matter if you're working elo on the project or as a team. 6. Pushing repo to Github: In previous video, we created Basic Git Repository and did several commits in this video. We will applaud our work to get home. Why do we need to do it all? It's good to have get project on your own machine, but it's not comfortable and secure. Normally, people use different services where you can store your projects. And don't Lord eat at any other machine anytime and the most popular off this project is get hub, so we will work with it. So get help is the service which stores get repositories and you can applaud it there. And somebody can work with you, for example on it, or you can work it on their own. And first we need to create an account in Get up. This is just simple registry, and I won't go through it because it's really easy, and I already have an account after registration and confirm in your email, you can just begin to get hump and you will see something like this. This is how my default screen in Get Hub look like. What we want to do now is to push our project in get hub, and for this we should create new repository. Indeed, we can just click new And this is the protests off creating your repository. And here we can set any name that we want. For example, we can name it Learning Gate and click create Depositary. We don't need any description and you can live it public or private if you want. Here you can see no some helpful commands about what we need to do. And there are two ways first of all, we can create in your repository. This week should do when we don't have any project yet. And we can push our changes to existing depositary. And this is exactly what we need because we already have a polder with our project. Also, it's important to choose here, https, and not as a stage for start. It's easier to work like this after this. We just need to copy command with get remote at origin and run it in our console project And this command ads you get observer in the least of service for our project. And now we can push all our changes and commit there origin. Is that the fault name off the server. Normally, people use it like this you can use here not remote origin, but any other name that you want. But Origen, just the standard one. Now we can check. What remote service do we have in our project? And for these there is a command Get remote. And then my anus version. And here we can see that we have in a region server with this year l And this is your EL that we corporate from Get hub. Now we can push our project to get help. Bush means to applaud the changes. So for these there is a second command. We can just copy it from here. Get Bush minus you. Origin Master, It will ask you for your log in and password from Get up so we can just feel them and heat Enter which she hear a message that our data was applauded to get home. If we're the Lord now, I would get help. Page, we will see our newly created repository in get hub. And here is our single file one Dodge. Yes. So basically here you will see the least off our files with names and we can even see the name off last commit, which changes this file. We can also click on the file and check it Sores cold. We can click on history button here and see all commits That changed this file. If we click on specific commute, we can see changes that we did here. It looks exactly the same. Like give show locally in console. Now there are also two other commands that we need to work with. Get hub. So the first command is get pool and let's try it now. And this command says that everything is up to date, What does it do? It takes all new changes from our remote repository. And in our case, this is from get hub. And we got the message that our project is up to date because we have locally last changes and they are the same as in remote. And let's say that we did some changes for example, at home and pushed them to get hump. And then we came to our office and road get pool. In this case, we will get last change is that we did at home off course. This happens if you don't forget to push it. When you was at home the second command you already seen. And this happens when we applauded our changes on Get Hub. As you can see, we see the message that everything is up to date, which means that our local branch does not have any new changes for a moment. Branch. Let's create known you file in our project and push it to get up like idiots. Amu changes for this we can use to charge and then the name of the file, for example, to jazz. And now in get status, we can see that we have a new file and this file is intact. That's why we're right. Get Ad and Dodd, then get commit and message and, for example, the messages added toe Js file. Now we did our committee and we just need to ride kid push as you can see who we see the message that everything was pushed successfully. Now, if we go to our report in get hub and reload the page, we can see file to Jess in report Also, the amount of commits now is not three but four, and here we can see our new commit added to Jess. So our repository is completely sink with Gil Cup and we can use it in next lessons 7. Working with branches in git: In this video, we will learn what a branches in get and how we can use them. Why do we need branches at all? And the answer east to share, coat and display it cold? Let's say we have only one project with main development, so we can't somehow make one feature or another feature or switch easily between thes features and between different states over the project. So basically here what we can achieve with branches. So let's say that our main ST off the project is called Master. This is our master branch and here we make our development. When we want to make some new future for example, authentication, we can create new brains from Master and call it Let's say feature like on the picture and now in your feature will make three new commit their marked with yellow here and then after future is finished, we can merge eat back in our master bridge, So basically we have different states off our project. We can go to any commit and let's say we're in master. We still only two commits there, marked with blue here, and we can go also tie feature branch on any commit and see in what state is now authentication branch. And this can help us to have different states off our get application and to switch easily between these states. Let's try this out by default. Get creates Master Branch for us I have here Master written so I can always know in what branch I am And we worked the whole time All previous lessons in Master Bridge There is a special get command to see all our branches weaken just right kid brain judge and see all branches that were created. As you can see, there is also a star symbol here near the branch. It shows us in what branch we're sitting now let's try to create new branch and there is a command git branch and then the name off the branch, for example Let's say the branches named implement new logic and brains was created So this is command to create the bridge and difficult check Now with git branch again we can see that we have two branches now and master branches highlighted as active and to change our current branch to branch, implement new logic we can write gate check out and then the name off the branch in our case, implement geologic. When we click enter, we have a message. Switch to branch. Implement new logic if we will right now get branch Command again. We can see that we're sitting in implement geologic French and not in master anymore. So we successfully created the brains and switches to it with command. Get account. Let's create now new function in our file to jazz. Let's just edit this file and create inside it. New file. For example. This is a function get person and we have here name and surname and we just returned name plus empty string and plus surname. That's it. Let's just save it and let's push our changes as we did previously. So if we're right kids status, we can see that our two Js file is modified. Weaken just right, get at dot and then commit, as we did previously and for example, here what we did we add it, get person function, Let's hit, enter and our committee is there now. We can just try to get push toe, push our changes to get hump as we did previously. If we check out now will get help triple. We can see that we have two branches here, master and implement new logic and we can change our brains here, for example. We click on, implement the logic, and we can see that we have five commits there on this branch, and the last commit here is added get person function. So if we click on file to Jess, it's not empty. And it here's our you cold. Now, if we will switch your brain judge to master back, we can see that we have only for commit here and not five, which means that the state on different branches for us is different. We have only four commits on master brains, but five commits on our implement logic. And this is exactly why do we need branches in get toe have different state in different branches. So, for example, here we have our master branch and our Project State is there. Then we want to do new feature lets say authentication. So we create new brains from our master and do all logic that we need about authentication there. But we can stop doing it at any time and switch back to monster. What is even more important, we can create several branches. Let's say we don't need feature without syndication anymore. But some other future and we can do it in parallel. Or several people can work on several branches doing different features. Let's try to achieve the same What we did in get hub from console Let's check what communities do we have in our branch? For example, the one to check in what branch we're currently Now we're writing Get branch command for these and it shows that we're on branch. Implement new logic now if we ride, get log we can see commit on this branch And as you can see, we have here The last committee added get person function Which means that on this branch we created this committee Now we can switch back to master for this We can just try to get you called Master And we switched our branch. Now if we will ride, get log We can see here only for commits which means our fifth commit is only on that branch and not in master 8. Merging branches in git: in the last video we checked how branches are working in gate. So now we have Master Branch and implement your logic branch Let's first which on range implement new logic So now we're here and our last committee is also here. We can see it with git Log Command Here we have added get person function At some point we're finishing our future with implementing you logic And we want to merge these changes back to master which means we're finishing our branch and we don't need it anymore So the question now how can we merge the brain? Djetou Master Toe put all commits that we did in this branch in our main master branch Just we need to switch to the branch where we want to make merge. In our case, this is Master and for thes weaken Just ride! Get tickled Master! So now we're in Master Branch to merge our implement new logic Grange there is a command Get merge and then the name off the branch. In our case, this is implement geologic French And when they hit enter You can see that we get the message That branch was updated and file to jazz was changed and here we can see how many changes do we get in our case, this is three lines and these three plus is which are green shows that this lines were added. And here we can see the message. One file was change it. And this file has three insertions. So this means that our brains was merged. Successful it, master. Now, if we will run, get log. We can see that in our master. We have now added get person function. So every time when we want to merge one branch in another, we just need to switch in this brain with command. Get check out and the name of the brain, for example Master. And then you can just it'll get merge and the name off the branch and actually here you can see the message. When we switch to master brains, we see the message that we're already in master, but our branch is ahead off our origin by one commit, which means that locally, we have this one commit and this one committee is not in remote in our get help project and we need to push it later there. But festival. Let's get rid off our brains, Implement new logic. Now, when we check our branches, we have two of them. But actually we're already managed the branch and we don't need this French anymore. And normally, when you are doing a lot of features, at some point you're getting a lot of branches. And when you finish your future, it is nice practice to delete the brains. And there is a command git branch. But with special attribute, you can write here miners there, which means I want to delete this strange and then the name off the brains. If I will run this command, you can see the message deleted branch, implement new logic and different will run now could branch command. We can see that we have on the master branch. The most interesting thing is, if we're allowed the rapper the rebel was completely untouched, which means we have to branches here and we don't have merge off this branch to master. So now we need to update and push all our changes to get, have. If we're around now, get status command. We can see that our master don't have any code that was changed, which is completely true. So now we don't need to run, get Ed or get commit. And we just need to push our local master branch to our amount. So we just try and get Bush and get bushes our changes to get hub. And now if we will reload the report, we can see that we have five committees here and he ever get this commit with added get person function. So basically what were merged into a master? We pushed no master in our rep. Oh, and Master is updated here and here we can see that we have committed edit get person function. But as you can see, implement new logic Branch is here because it was not deleted on remote and was only deleted locally. We can basically just goto branches and heat here, delete the branch. So here, implement new logic and we just need to click on it to delete it. Now, if we go to branches, we can see that we have on the one bridge our master branch. So basically, after do in the future, we should get rid off our branch and work on Lee with Master and then we start to do you fish. We create new branch were making your logic there, and we merge it like with it previously 9. Uploading and downloading code from Github: in thes video. I want to clarify more deeply how get pool and get pushed. Commands are working and let's start with get pool. As they said previously, if we run, get pool, we will pull Our latest changes from Get Hub will always get this message. Everything is up to date because we're working on Leon Single Machine, but we can reproduce the case when something was changed in remote and we want to pull this . It's completely possible toe do some small changes directly in Get Hub. And for this we can just open file to jazz, for example, and click on Edit Button. Let's put here some additional symbols for our string. After these, we can commit our changes directly in get up. There is a name here like a place holder of the day to jazz, but we can write any other commit message here or even and description. And here is the radio button could mean directly to Master Branch. It's also possible to create in your range for this committee if needed, so let's just commute our changes. And if we can see now we have six commits and the last committees update toe Jess. And if you click on it, we can see that with the changes with changing our string. So basically it's possible to do some small changes in get up. So now this means that our amount was changed. But locally, we don't have this changes. And normally we can just ride, get pool to pull all our latest changes. And as you can see, get found our changes in get help and we guard Nuka Meat and our two Js file was changed. Now we can ride, get log and see that this update OJ's commit is there. So let's discuss what get pulled. Command is doing. Basically get pull command, do two things. First there is a git fetch command and this command only dulled Lord, all new data from remote locally so basically can always run, Get fetch and any changes won't be applied. So we can just use this commands always and nothing will be broken. But after this command get pulled inside, make other command And this command we already know this is get merge. So get full command takes with get merge branch from origin slash Master origin slash Master is our master branch which is situated in Get Hub and then get tries to merge this branch directly in our master local branch. But basically every day I am only using git pool Command without any arguments, and it is just working out of the box off course. It's possible that get pulled command while doing merchant will get some conflict. This happens when our local files are not the same as in remote and get can't make automatic margin. In this case, we need to resolve conflicts by ourselves and continue working. Who will learn how to do this in our next lessons? So get fetch on its own. I never use and basically get pulled. Command is a shorthand for full command. Get pool origin master. So basically in this command were saying from what remote? We want to get changes and what branch will want to pull by the fold, get checks our current branch and takes the fall to region. So, basically, that's why get pull command takes as a remote our first region that were added and then uses the muster branch. Let's no talk about get push, actually get pushed. Command just pushes our changes to remote and basically this is also a shortcut for command . Get push origin Master. So it works exactly the same. Get checks. What current branch? We have brought our default remote and pushes there very often. You can see the problem that get pushed. Command keeps us a narrow and keep Doesn't know what remote bridge it should take. Let's check it on the example. First, we should create new brain. For example. Branch with name can't pull, but let's do it a little bit differently. It's possible to create a branch and switch to it directly. There is a command git check out World didn't know it, but there is a special key minus b and here we just say a name, for example can't pull in this case. We will create the branch counter pool and switch to it directly. So basically it the same like running gait Branch counter, pull, Get tickled, can't pull You will hit Enter. You can see that now, Will Ron get branch and we're on the branch can't pool and this branch was created and was jumped there. Let's try to push now our branch We just need to run, get push and As you can see, we can push our brains to remote. Let's no try to run. Get pull command like we did previously. As you can see, he ever get an error. So there is no trekking information for current branch. So basically, this means that get doesn't know in which branch in remote it needs to push. So there are several ways to fix this problem. First, we can just run full command so we can run, get pool origin, can't pull in this case, everything is up to date and command worked. But it's not that efficient because we need to type more, and it's boring. Actually, if we will run, get pull again. There is a hint from Geet and we can set tricking information for this brain. With this command weaken. Just copy it. And Ron, in this case we're writing get branch with minus minus set upstream to, and then origin slash And our branch, in this case, weaken just right here. Can't pull. Which means we're setting for this current branch upstream with name, origin, slash can't pull and the local branches can't pool Now when we hit enter our local branch can't pull is tracked in remote branch can't pull after these. We can just use always get pool. And for this branch it will always work. But you will hit this problem again and again. When you create new Grange, I will show how to use get pool command without taking information in our next lessons. 10. Correct workflow with git: we continue to learn Geet. And in thesis video we would learn about correct git workflow. So we will clarify how several people can work in one project together with outbreak in something and how this process will look like and hear how it looks on the picture. So here we have several branches on which we're working. On the right side, you can see our master brains. This branch is the only one which will be deployed to production. It's our most table branch. Also, we have developed range. This is our main branch for development and here is the idea off this workflow. First developer wants to make new feature in project Let's say that we want to make oath indication and first we need to get last changes from developed range and create new Grange for this future. Now we created our new feature branch so we never do any changes directly on develop Branch were always making you branch. When we want to make something you next developer do some changes on this future. And when feature is ready, it's cold should be checked by other developers, and each function analogy should be tested by K department. Now our developer can merge it back in developed range. Then at some point when several new features already and project manager want to deploy this to production, somebody should create a release. Brains were always create our released French from our developed brains and test this branch separately to she that all features of work and go together when released branch was checked and old box there were fixed in release. We merge release branch to master The whole purpose off release branch is to have a separate place where we can test our release. After that, there is also such thing as a hot fix. So if we found some bargain production, we should fix it right away and create new branch for the hot fix from Master fix it there , test the branch and merge back to master and develop because we need this new changes in both branches. I think it sounds very complicated for you, but let's try to work with this fork flow and understand its benefits. Now we have only a master brains. Let's say that this is our stable released now. Now we should create first developed range from Master Bridge and reused to commands previously, or a shortcut of whisky, each account where miners B and the name of command can be provided. So we just created developed range ends, which to eat. Let's put it now so our get hub is up to date. Now we should create our new future for authentication that we want to do for this. We can just ride, get check out miners B and the name of the future. I want to prefix it with feature and slash, and I will tell why in a second implementing else we could enter and was switched on, our future implemented out. So it's good practice to start the names off the future with future world. In this case, we can understand from the name that this is future and not a buck, for example. Now let's say we start to do our future, and for these we should create new file out GS where we can add some simple off indication function. Let's just open this file and create some function health. Indicate where we can get log in and password as a perimeters and check here if longan equals lugging and password equals password then we can say return you Ah, locked in Then if everything is bad, then return. Le Guin is not correct. Let's say that we finished our future. Then we need to create new commit and pushed those brains off course Normally, feature does not consist Onley off one commit but off a lot of them. Each logical chunk off our future is going to each own commit Now we finished our future and we need to push it to our brains. So we just heat, get at dot Then get commit meanness M as we did previously. And here we can write adit authentication. After this, we can ride. Get Bush to update our brains in Get up normally somebody should test the strange either other developer or curate department. So maybe this branch will be deployed to some staging work. You guys contest the functionality off this future. So let's say that this feature was checked and now we need to merge it back to our developed range. Let's first jump to our develop for this We can just read getcha called develop. Now we're on developed bridge to merge the future. We can ride, kid merge and the name of the future. In our case, future slash implement in south. And as you can see, our developed branch was updated. And when we try, get log. Now we can see that here we have new commit edit all syndication. So this was the first part off our get flow. We always work on develop brain judge. We create new future from this developed brains would do something there. And after checking who emerged this future back to develop At this point, we can completely remove our branch where we did the future because we don't need it anymore. 11. Why do you need releases in git?: At some point, our project manager wants to deploy what we did to production. And for these we should create Release Prange and test everything there. And if everything works, Merger toe master Brain judge. Normally all releases are created with semantic version in, but it's another topic. So for now, let's just use for our release version 1.0. First, we need to create new branch from develop. For this, we can just ride, get check out minus b and here we want to perfect our brains with word release. And now goes the version off our release. So we successfully created our first release brains and switch to it. It's time to test our release. So we should deploy this brain somewhere work. Yea, guys Or, for example, product ona can test this branch and find some bugs. Maybe. Let's say that we have a bug in our future and for these we should update our future. So here we just made some mistake and we showed Putin exclamation mark in our string. So we fix the bug and we can just commit this changes in our lives branch For this we can run, get add as always then get commit and for example, fix it Authentication, warding. Then we can just commute what we did and push it to release French to get her At this point , our branch is ready, everything is tested and product owner is happy because everything has worked. It's time to merge this branch to master and to develop. Why over should merge it to both branches Because master should be updated with our new features And in develop everything is there but our fixes that we didn't this branch are not there Off course we don't want to lose them. That's why we should merge Two balls branches for now Let's just which with get you called toe our master branch and run Get merge Release 1.0, Who was successful emerged Our changes to Master Branch Now it's enough to run Get push an update our master branch in get hub Don't forget to switch back to our developed range Get tickled develop were here and now we need to run Get merged release one point. Oh, and as you can see, we got this small change with label in developed branch back now we can also push it to get up. So this was the part of the get flow with creating releases. Some point we need to create a release from developed brains tested, make some fixes there and then merge it bag in developed and master branch that it 12. Why do you need hotfixes in git?: Of course, there are no projects Result box which means sometimes we get them on production and they're really urgent. So we should fix them in mustard range and deploy really fast to production. And we have a special flow for these. So first we need to create new branch for hot fix from Master Branch. Then we should fix this bug there and merchant both to master and develop Branch Master want update to deploy to production and we should not forget update developed because in other case, this hot fix would never get there. So let's try the salt first we need to switch to our master branch. So we're here now. We should create new brains with kitchen called miners be. And now we want to use perfect hot fix. We head our release one point haul, so our hot fix should be one point open one This is Haus Am version works for our patches. Small hot fixes. We'll update the third number here. Let's just create this branch. So we're here and now we should fix our urgent bug in authentication. We need to change our text. Your luggage 18 into text. Welcome and exclamation mark. So we fixed our hot fix and now we need to merge it both in master and develop branch For this we can simply commit our change in hot fix. Prange So we can ride, Get commit Mind this m fix it text before Welcome. Now we can just merge this branch back to master and develop. Let's change our brains to master and run. Get Merge Hot fix 1.0 point one Let's push our master branch again. Toe, get hub. We also should not forget to update our developed branch. For this we can simply switch to our developed brains and Ron get merge Hot fix 1.0 point one and then could push command top date our develop. So we finished with our hot fix. So we first create our hot fix branch from Master. Then we fix our bug there. Then we're committed to this branch. Then we switched our master branch and merge our hot fixed there. We're also should not forget to switch to develop branch and merge our court fix there also to get out back fixed there So we went through the whole flow off development There can be different flows in different companies, but a never in JDate look similar, and you can ask why this flow is so complicated. So let's speak about it. Benefits first. A lot of companies used it for years, and it just works, indeed, scales to a lot of developers. When you create teaches, you split what you're doing from Main Branch and simplify checking the code. You can also merge it at any moment. All continue doing it later when we create in check releases were Avoid getting untested cold in master. If you merge, develop range directly in master. It can happen that several features are conflicting or somebody emerged. You commit in develop and you'll merge to eat to master, and it will break. This flown gives you safety toe a work break in production with new changes and makes your development much easier. 13. Simplifying git workflow with Gitflow: in last video Vreeland. What is the comfortable flow to develop project together with other people? In this video, we will try to automate a workflow that we did previously. It's really painful to create features hot fixes and releases every day because it's just boring work and you need to type quite a lot. That's why there is a lot of different libraries and possibilities to improve it and make it better. We will use such tool, which is called Get Flow. It's really popular one. And to install Little Mac, for example, you can just ride brew, install Geet dash flow. This will install this package for us. I already have eaten style, so I don't need to do anything to check how to install this package and other operational systems. You can just go to get hump in replicate flow. Here it ease and scroll a little bit. And here is in Stellan. Get flow. We just click on installation instructions and check how to do it on every platform. There is also manual installation here if you need it. After installing weaken, just check that it is installed correctly. Runnin get floor command if you get something like these. The commands that I available for using this means that get flow was installed successfully and we can start working after installation. We need to initialize get flow in our repository. And for this we can just go to our council, get folder I'm over the here and run Get flow space in it. This innit command is what we used to initialize get flow in our projects And here we should answer several questions. The main questions are what are the names for master? Develop hot fix and release branches. So the branch for master we can live as it is and just hit Enter for the next release Weaken Just use developed range Which will be the development Grange then how we want to name supporting branches So future branches we want to name with feature Perfect just hit Enter release with release Practical hot fix with hot fix Prefects Support branches Actually, we don't need and we won't use them but But we can just hit enter and Russian tech graphics we don't need also so just yet Enter Now our wrapper is under get flow control So let's go through the flow Lakewood it in previous lesson. But using get flow and to create new feature, we can write get flow, then word feature, which means that we want to create new future and command start because we want to start it . And let's say I'm a new feature that we need to do is to implement registration so we can just name it, implement registration. That's it. And, as you can see, get flow did a lot of things for us. So it created new branch feature slash implement Registration is you can see here so we don't need to write feature in name also because get flow, did it for us and also get flow switched us toe this new branch Now also, there is a message that we can start committing our changes and when they were done, we can simply run, get flow feature finish and the name off the branch. So let's no do some changes that we plan to do in our registration feature. So I would say that we need to create new file which we can name register dot Js and now let's edited and add new function. We can call it register and we need here. Log in and password and inside, inside weaken. Just return, String it count then merged these with empty space. Then add looking, then one more empty space. Then password. One more empty space and string was created. So nothing really special. But now our future is ready. So if we're wrong, get starters. We can see that we haven't tracked file. Let's add it as we did always, always get. So we just add this to get raking and then committed with some commit message. In this case, add it, register our community is all to do that now we should tell get flow that we finished our future. And for these we can run, get flow feature and instead of start were just right and finish And a lot of stuff is happening here. So, first off, all this command marriages our future automatically back in developed bridge And it also deletes our future branch and switches to develop branch. And this is just in Silicon Command. So we don't need to do it manually, as you can see, get flow already switched us to develop branch. Now if we will write get long, we can see that our in U commit edit register that we did in this separate future was successful emerged, and now it is in developed, which means our flow was created, future and merging. It works fine with get flow and it's much easier now. Let's create release like we did in previous lessons. For this, there is a commanding get flow, which is named release and then start and the version off release. And let's say we want to do in you release, which is 1.1, which is the next. After our old release, 1.0 and difficult hit Enter Get Flow will scream that we have released 1.0, which is opened, and it was not closed correctly. And this happens because it didn't delete it from our last lesson. So let's just delete it. And to delete branching, get weaken just right, get branch and then minus D and the name off the branch. In this case, release slash 1.0 When we should enter our branch waas successfully deleted. So let's try to run, Get flow command again Now get flow says that everything is good and with reach it to the new branch released slash 1.1, which could flow creates for us. And then we're now on release 1.1 and we should start committing. When we don, we can simply run get flow release finish 1.1. Let's say that everything was tested and we didn't find any box, so we don't need to fix anything, so we just need to fingers the release. Let's run command, get flow release finish 1.1. What happens now is get flow creates emerge and opens the editor to write commit message for us. Previously, every time when we create new chametz, we used minus m attribute to write commit message in line. Without this attribute, get commuted Will open default editor to set commit message for us and in this case, get flow didn't use this minus m attribute and just open default editor So basically here we should ride the name about why do we need to marriage this French but basically merch Branch release one point bond is the good name and we just need to save this file then now get flow opens again the commit message and here we need to write a message for the tank. I will tell about Tex more in the next lesson, but basically it's just appointed to say that in this version was backed, several commit with some features now weaken Just right here 1.1 and save this file. As you can see, get floated a lot of things farce. So get flown, merged this brain judge together in master and develop, then created in you Tag We will talk about it later and also deleted our release branch. And this everything is single command. So that's why get flow is such a fishing too. Now let's say that we want to make a hot fix for production. So normally we just create branch from master and then merge it back when it is ready with get flow. There is also a special command which is get flow hot fix, then start and then the name. In our case, it was the hot fix for release 1.1 just you tend to and there is an existing hot fix. This is exactly the problem that we're already head. We created previously our hot fix but didn't delete it. Let's do it now with Git Branch command with minors deaky and here we need to write hot fix 1.0 point one. Now we deleted this branch and just read Let's run our hot fix. Start again. It creates for us in your brain hot fix slash 111 and switched us here. Now we can start committing our hot fixes. And when we finish just round hot fix, finish. Let's just do a small hot fix in our file registered GS. Let's say we want to put a exclamation mark at the end. Now we need to commit. This changes as always. So get ad, then get committed and hear a message. Fixed registry register and committed there. And now we can simply run, get flow hot fix, finish and the name off the hot fix. As you can see, Get flow opened again Default editor So we can explain why this merger is necessary. In our case, we can simply save this file and create the tank, so the tag with hot fix should be exactly the name off the hot fix. So in our McKay's 111 let's just save this file and here is one more merge. Let's just save it also. Now, what did get flow for us at this case? First awful. The branch was merged both in master and in develop. Then the hood fix was tagged and the brain for hot fix was deleted. And this is with single command. As you can see, get flow Helps us to spend less time right in commands and be more efficient with git. 14. What are tags in git?: in this video, we will clarify what attacks in Get if we will write command, get tag. We will see all our created tags And tag is a mark in history where we can switch. Most often, people use tags for market releases. After each release, we create in you tag and people can use cold exactly from this tag. And don't be afraid that new changes, for example, from master or developed brains will break our cold. Now let's which to master brain judge and try to create in you Tank. For now, we know that we have on the two tags 1.1 and 1.1 21 to creating you. Tag, we can simply right get tag and the name off the tech. For example. 1.2 when the duties then you tag is created. We can see this if we run. Get a command. Now the question is what that the stag has inside exactly the same state like it was on Master Branch. When without this command, we can check it with git log These bunch of commutes like it wasn't master is now on tag. So basically in tank the last committee will be this one. But let's say that we want to create in you commit. Let's change something in our project for these. For example, let's open file one point jazz and add something here like console log tags. As you can see with command, get status. We have modified our file one point. Yes, and now let's commit it, as always with get ad and get commit command. And here, for example, added logs. Now let's push our branch toe get home, like with it previously. Now let's ride get long as you can see what hell when you can meet at it locks. Now let's create in your brain, which will go not from master, but from our tag. So we want to check. If really, our new commits on master doesn't have anything to do with our tax. And for this we can just right get you called miners be than the name of the branch. For example, some brain judge from old tag and the version off the tag at then, for example, 1.1. Now let's ride, Get lock command, And as you can see here, we don't have the last commit about Edin logs. As we have on Master, this is exactly the same state. What Waas when we created this tag 1.1 so we can always create new brains from the tag and not from the branch like master or develop. Now the only question is, how can we push our tax too remote, for example, to get help in our case when which I'd get pushed command? It pushes on our changes and not tax. And there is a special key for these to push it. But let's check that they are not pushed. If we will realize our rep Oh, and here click on the branch. So here we can switch to branches or tax. And as you can see, we have some branches but on text we have nothing to show. So let's push our tags and get help. Can see them for this week. Unjust tried, get push with minus minus tags. This command will push not on our changes, but also tax. And as you can see, there are three in your tags and we just pushed them to get hub. If you will the Lord our project again. We can see here not only branches but tags. And we can click, for example, on 1.1 and see here not for team commits but on the 11 commits because this is exactly a snapshot off some state that was previously one. We're old, this command Now. People can just take some old tag, which is like super working and was really good tested from our get help report and use it directly and not the branch like master or develop, which could be not that stable. 15. How to resolve merge conflicts in git?: in this video. I want to talk about merge conflicts and get at the moment when we ride, get merge command and, for example, nurture our future branch in tow. Develop branch, get rise to merge all our changed files automatically between these two branches. If get can merge this files automatically, we get a merge conflict and get shows us a message that in these files, for example, we need to resolve conflict by hands. And the first question is, of course, when do we get conflict and how to avoid them? So when two developers changed the same code in one file and get cannot resolve it on its own, we get emerge conflict or, for example, if you are at work and you change some code, you pushed it in rapper and at home, your old get pool. It's possible that he also will get a conflict. So here we want to try to resolve conflict on our own, and first we should simulate conflict, which we need to resolve. So let's first create new branch for this, for example, with name conflicted branch branches here and with which the need. Now let's say we want to change our just file. Let's open it. And let's say we need to change some logic here. For example, Change the message here, not return and welcome. But return and High Guest save it and closed the file. Now let's come in this. Get Ted, get commit, as we did previously added High guest message. So this is our future branch. Where did this changes? But let's say somebody change something on developed bridge. Let's try to do this for this. We can get you count, develop and then let's say we want toe edit out just once again and limo, remove this logic completely and just say return. Welcome. So basically like everything was simplified. Now let's say that somebody edit this changes and committed them like simply fired authentication. So now, in developed brain, somebody simplified our function and created new commit and on our future brains. We did changes that we need on ourselves, and now we should merge our branch to develop. Let's try to do this for this. We can ride, get merge and then conflicted branch when we hit Enter Gates says that Ulta merging failed and please resolve a conflict and making you commit. So if we will right now open our our Js file. We see that it looks strange. It is separated into two different parts and one part here is head like this head is the title of this part. And the other part is the changes which were made on conflicted branch which basically means head is the current branch like develop and these are changes from complete conflicted branch. As you can see, here is the name off the bridge. So now we should change this file on our own and remove all errors and get symbols from here. So let's say the changes that were done on develop branch are not needed and we just need to take our changes. So basically it should look like this after we remove all arrows from gate and did it coat version that we need. We just need to save this file and commute changes. So basically, get ad, then get committed. And here, for example, Message merged with conflicted Branch. Now you've provide Get log on develop. We can see that here Our last commit was merged with Conflicted Branch And here we resolved our conflict and created in you commit. Just imagine now that you get like, huge amount of changes. And for example, you have conflicts in 10 different files and like each file has five or 10 conflict and the each file, it's like five lines of code and you should do it all by hands, and it is really painful. That's why there are a lot of graphical merge tools which can help you if you want to use any off them. The best graphical merge tool that I saw was implemented in intelligence I d. Or, for example, PHP Storm. This is paid I d. But if you for example getting three license from your company where you're working, it can be really useful. This example is from intelligence I D. But basically all graphical tools are working the same. So here your screen is split ID in three sides on the left side, you have part two with local changes. On the right side, you have a brain which you merge in current branch and on the center you have what you will get, and then so basically you just can click with crosses and arrows. What part you want to apply off course. Sometimes it doesn't work that good, and you should resolve it manually. But it works much better than just can't work. If you're working on a small project, you don't need any graphical tool. Basically like one or two people won't get that. Men emerge conflict. So just result everything by yourself. And don't try to find, like the best graphical tools to do it when you get, like one, merge conflict per day or like, per week off course. If you're working in a team like off 10 people and you're getting in team like 100 commits per day, for example, then maybe you need a tool. 16. How to stash your code in git?: Sometimes we're making changes in French and spontaneously. We need to switch to another branch or task, and we don't want to commit our changes because they're not ready yet. And we, of course, don't want to lose them. And right exactly several commands in Geet that can help us. At this point. This commands are called Get Stash. Basically, this means that you put all your changes in stash like in Pocket, and you don't see them anymore. But they off course as there, and you can get them again when you need. So let's try told. First, let's say that we changed our house GS file. So let's opening. Here is our South indication. And let's say that we add some you Logic, for example, would change the label. And now it's not high guest, but hi everybody. Now let's save our file. And now we have some changes and they important for us. And normally of course, you would have more changes, but we don't want to lose them. So now when we ride, get status, some off our files are modified and suddenly we need to make something different which is not related to our Jess at all. And we just need to put this changes somewhere so we won't lose them. And in this case, we need to your stash. We can simply right kids stash. And as you can see, we get the message saved working directory and index state work in progress on develop. And here we can see our last commit merged with conflicted brains. Now, if we will write, get status, we don't see our changes at all. It looks like completely clean French. But our changes are in stash. So now we can easily change Granges or just do other stuff directly here. And we're not afraid off losing our cold. So basically, we can just continue working and everything is fine. But at some point, we want our changes back. And, for example, we finished what we want to do, where we switched. And now we want to switch back. So we want to get our changes back from stash. And for this we can simply right get stash Pope. And when we hit enter. As you can see, we're still on branch develop and we get our changes back like were stashed them previously and at this point, when variety get status, we see that everything is looking the same like it was previously. And we can just continue working. So what does command gets this pope do? He deletes this item that was stashed from stash and applies it back as our changes. So this is basically the simple flow, the time using every day to put something in stash and get it back. But the right to problems in here And the first problem is that sometimes we have files that are not dragged yet by get and when we use get stash, get won't do anything with them because get doesn't know anything about them. So basically, we're stash in something, and our new files that were created won't applied in stash. And then we can mix what we did in first task with Second Task and it's not good. So basically, before we apply everything to stash, we need to add it to get index, risk it head and dot command, and just don't forget about it. The second problem, it happens when we want to use git stash several times, for example, we made some changes and reapply get stash, Then we make some new changes and remain Get stash again. And the problem is that at the moment when we use gets Tash Pop, we just get the last test cold. And sometimes it can be Not that we want, because we just get the last stashed bunch of files. So at this point, we need to know how to check all our Stashes and to know what we want to take. And for this we can simply right get stash list. And as you can see here, I have only one stash. But basically, this command will show all of them. So the first But here is the i d. Off our stash. And this is, for example, the i d off last commit. And basically we can use the idea off our stash to do some stuff visit, For example, using this a d. We can get our changes back from stash to our branch. So let's say that we want to use our stash zero. In this case, we can drive, give stash pope, and then stage at and with this bracket zero so basically gets dash pope and they d off stash. When we hit, enter our changes will be get back in developed range. So basically get status now shows that we have modified our files. What else can we do it with? Stash Command. If we will ride gets specialist again, we can see that we don't have anything. And this happens because Pope takes it directly from stash and boot to our local changes. So let's put it toe get stash again was get stash Command now gets dish least will show us our stash and let's check what is inside this stash and for these we can use gets the show command And here we need to also pass get stash at and here zero. As you can see, we get some information, like what files were changed and how many in sessions and delusions do we have. But it's not that useful because it's not enough information to understand what is in stash . So basically, we can add to this command who is gets the show minus b attribute, and this will show all changes from all files. So basically here with received it in our stash, we changed our high guest. Oh, hi, everybody. So, basically, this is all our changes in this stash. Basically, these are all commands that you need to know. It's enough to just use, get stash and get stash pope toe work every day. Sometimes when it becomes difficult, you can check what is in stash with Skitch touch list or use gets the show to check what is inside. The last command that I want to show is how to delete a stash, but I am using it quite rarely. Basically, let's try it. First. We need to check what is in stash. We have something in stash and let's say that we want to delete it to make our stash clean for this week. Unjust, right? Get stash drop and they d off stash. In our case, stash zero. When we do this command, we see the message drops that stash, and now when we check our least, our at least is empty. Some people make lots of Stashes and like to set names for each stash. Tono was their station. I personally don't use this approach, but maybe you will find it useful. So if we check now with get status but don't have any changes, let's tow them. For example, High Guest and one more exclamation mark. So now and get status has some changes we can stash them with get stash. But now we want to add a message. And for this, we can use gets Tash Bush and then with minus em like we did was commit, for example, change. It calls, Jess. So basically gets Tash push. Just push changes in stash like just get stash. But minus M allows us to said the message. And when we hit and now we see the message that we saved working directory on develop and here is the name off our stash. Now, if people ride gets specialist, we see that our stash has a name on develop. And this is quite good to understand what exactly these changes are. And what is it all about? So you see here not only commit with some random name, but exactly your message that you said previously, As you can see it gets, Tash is a nice solution when you want to store some changes that you don't want to commit in stash like in the pocket and use them later 17. How to copy your changes?: Sometimes while working, you need to copy some small changes from one branch to another. Let's say that you created new brains and you're working a need, but you found a bug, and it's really critical, so you need to fix it on develop. Also, one way is took a meat off stash things that you did on the Sprint switch back to develop and fix this bug there and then merge developed branch in our feature brains. The other way is just to make a fix of this bag in current cringe and committed normally. After these, at any moment, we can copy this committed in any other branch, for example, in developed Bridge, and this process is called cherry Pick. When we need to copy some commits from one branch to another. This is exactly what we need, so let's try this out. First. We need to create a new feature branch for these. Let's say our branches named South changes. We're now on this branch and we need to do some changes. Let's change our file, our chest and, for example, right here, not high guest, but hi everybody. Now let's just save our file. And if we will drum, get status. We see our modified Our Jess. So basically, these are our important changes that we want to corporate to develop. Branch. Now, let's just commit what we did in you commit. So we need to add our changes. And we can ride, for example, fixed our Jess toe do a cherry pick command. We need to know the i d off the committee. And for this we can use get look, command. And we know that this is our last commit fixed out And this is the hash of the community. So let's go, Pete. And two Children peak this toe developed range. We first need to switch to this branch. So basically, if we want to get this changes in the l a branch with which to develop, if you want to do it on master, with which on master now we just need to write get Cherry Peak with dash, and then the i d off the committee. So this Sadie, I just got it from get log when we hit. Now enter. As you can see, this commute fixed south is here, and this is exactly our changes. What we did but there is one important moment this is in you commit. It's not the same commute like it was previously. As you can see, this is the hash off our old commit, and this old could meet is still on their branch. But here you can see that this is the new committee. And then right here, get log. You can see here fixed out, but they d off. The committee is completely different, which means that were duplicated, commit. And sometimes you don't want this. So you should be really aware off these when you're using cherry pick in the same way you can do with several commits so you can just tried get Cherry Peak. And here is the first a. D. And for example, here is the 2nd 80 This will apply to commit, but it's not there moving communes. It's the complete scorpion off to commence, which means it will pollute. Commit history because you create every time and you copy. So if it's possible to do what you want with just normal merge, just use it. But if it's not enough, just used cherry pick 18. Configuring git and git aliases: in this video we will learn how to configure git and would get analysis we can create. We're already clarified that there is a get conflict file in our home directory. Let's check it once again. Let's just open get conflict file and it is started with dot We're already configured it a bit when we added user name and email. So this is our global conflict. Forget and it is applied to all our project. We can override it by creating get conflict file inside our project Let's go back in our consul get project and this you can see here there is a dot folder and inside we have a conflict file we can open now and basically thes are our local get conflict file for only this project and only on this machine We never push dot get folder to remote rapper which means that every developer can change this file in this get rapper on its own and it won't be pushed to get. As you can see, it is not empty But most configuration here is about branches and water region that we have and how we're working with it. We can apply all changes by hands here or by using git commands. So first thing that we can do is change the user name and user email for only this project . Weaken dough this by right in, like previously get conflict user name and here, for example, food. And then we can write user email, for example, full at Gmail. Don't comb. This is really nice when, for example, you don't want to have your global conflict in your local project, for example, you're working with different email in different companies and some project er, doing for one company and other project for another. Let's open our get conflict once again and check. What do we have here? As you can see now we have a DAND use a section with name and email, which means, for example, if we do any changes now in our project, for example, we don't have anything right now. But let's change of both Jess and remove here exclamation mark when the safe file and committed as always, get commit and fixed hours Js we can see with get low command that the last commit was done with the name food and not with my global name, so As you can see, local git config allows us to easily change our information in global configuration. In our get configuration, we can easily change the editor which will be open during merge or commit. We can simply right here git config, then core dot editor and the name off the editor. It can be, for example, theme sublime V s code or whatever you want. I prefer to use vim. Let's check now our configuration once again, as you can see here in core section now, Editor vim was used which means gate will open beam every time when commit emerge. Heavens. But as you remember when we used git commit with minus m command, this editor won't be opened with just that said our message in line. Now I want to talk about get dialysis. Why do we need them at all? Of course, the right less code in commands because it's really boring to type a lot of them and you're doing it every day. So in our conflict file, we can define any ill s is that we want in this video. I want to show all popular palaces, but actually I am using them a little bit differently and I will show my configuration in the next lesson. So for analysis, we can ride, get Kontic, I'll s and then the name. And for example, we can use status Ahlers to make it shorter. For example, Estelle and status. When we hit, enter eyeless was created, which means now we don't need to ride, get status, but instead get a stair and it will do the same if we will check our conflict. Now we have Alice is in the section Allers and you can see here Este equals status. So basically you can write unless it's with command or just change conflict on your own. It's also possible to make analysis more shorter. As you can see now we get a lot of information and a lot of messages to read. We can use git status with minus minus short attributes. As you can see now we don't have any text. This is the short form which will show us exactly the information that we need. So let's add our in your islands in get conflict. We can just say that este is one Islanders, but we can also create Alice s and it will be status minus minus short. Now, when we will use, get as it will use the short form of the command git status minus mine and short. Let's change some file for example, Out gs and adhere exclamation mark. As always, we'll save this file And now we're right and get s and we see only information that it was modified. We really see on the short and focused information another popular islands is get branch we can right here Git config a less dot be our branch As you can understand, it's enough now to know tried Big branch like we did previously But give b r and it will do exactly the same The other nice Ahlers is fortune cult so get conflict are less And here we can write c o check out which means now to change the branch. We don't need to ride, get check out master, for example but gets your master. And as you can see, we cannot switch the branch because we have local changes and we need to stash them previously to switch branch so we can simply ride gets there's here and now use our analysis fortune count so give check out Master, as you can see where? On the master branch. But we used our new islands for this which is really convenient are the unless which we can create east for commit. So for this we can ride, get config I'll s see, I commit as you can understand Now it's enough to write, get she I and then minus message and the name off the message off course you get the message Nothing to commit because we don't have any changes But this command will work as get commute minus em fixed The last islands that I want to show is for push We can simply right get conflict are less be Bush which means now it's enough to ride, get p and not get push which saves us a little bit off time. As you can see, these are all default I'll esses which people are using very often off course You can configure your own analysis but these are the most popular. I cannot recommend you to just create like thousands off glasses when you just start to use get in console. But of course, after some time off, using get in console you will adjust your own analysis which will be really comfortable only for you 19. My git aliases: in previous video I described most commonly uses get are less is in this video. I want to talk about my guitar. Less is I created them during last 10 years off using console get And, of course, at the beginning of learning git I use Standard are Less is like a shoulder in previous lesson. But after some time, I improved and optimize them to be more effective. For me, I achieved this by mixing stage are less is and get a less is there. Sage is just replacement for Bosch, which is working in the similar way but has some improvements in any shell. You can get the same like I'm doing with this age. Just install some ill s is for bash or, for example, for future over tell you're using. Let's start by shaking my Zs, Asher see, So here are less is not only forget but for whatever I want is just for my shell. And I also have get conflict. And here is my section eyeless. So basically, sometimes I need to install something here, and sometimes I need to add something in my secession. See, So let's start with Get At command were normally using it like this. Get ad and then dot here in my CSS your C I have toe glasses. Forget ad and forget at dot The 1st 1 is J A just get ad And then, for example, a file and J a. I am using like, 100% of the time toe Add everything. Normally I don't need the 1st 1 but this is just for the case. So basically, it's enough from you to just write g a and this will call inside Geet Ed and then dot So it's really convenient to add new files like this when we want to commit something, were normal, right and get commit minus m and then a message. My islands for this is G. C. Here you can see it just see is get commute minus a m. So basically this add the files if they were modified and add a message So now I can use it like gc and then a message, for example, work in progress. This is exactly the same. Like writing get commit minus a am and he have work in progress. But you can see how less I should type to push my changes to remote for example, to get Hump, I have analysis GP but it's a little bit tricky command. It's not just I last forget push. It's a little bit different. As you can see here in this age is he GP is analogous. Forget published but keep published Command does not exist It whole I created it by myself So you can see here in git config When I will write publish, you can see that I have a Nawaz publish which is a get Allah's And here I am using get push minus you are region and then get French name first Awful get branch named Command does not exist also I can find it here And this also another islands that I created. I don't use dis Alice on my own, but only in get published command So this are less Get me the current branch name. As you can see, I can right here get branch name and they will get current branch. This is useful inside the published command here you can see that we modify get push command and we put inside the another command get branch name So basically this means that we push the current branch to remote origin and said it track with upstream branch with minus you. So it's not exactly the same. Like we're just writing Get push here We always said in what branch will want to push. That's why we never get get arrow that get doesn't know in what branch we need to push And now I can just right gp which is analogous Forget published and use a so you can see here Branch Master is already set up to track remote branch Master from a region which means it's GP not get push back get published which is my command to write something like gate push minus you origin And then I get the current branch automatically which will be master Basically this is the full command and other useful island is get pool as you can see here in there sage, I have analogues. Just forget pool, which is J P l. So it's enough to write like this and this is get pool command it the same, like writing get pulled for switching branches were using it. Check out And here is the simple I'll s G c 00 It means get check out so I can just write G c o and then the name off the branch. For example, develop and hear my also. The reason Aaliyah's to speech directly to master as we have master in every project doesn't mean where you're working. This means that we're using it quite often. So here is GCM and we're back to master. And of course, get status. I already showed in previous lesson how we can use git status minus minor short. And here the Islas Gs Forget s off course, Get test Common does not exist in gate and it is my Ahlers as which is status minus minus short. So now I can just write Gs in Consul ended the same like writing Get status minus minus short. It gives the same result. We were also using it Log quite a locked and it looks like thes by default. I have a Nell s G l, which is Alas, forget l and G tell is a custom. Get Aaliyah's with log minus minus graph and minus minus day chart. And let's check how it looks like as you can see here. First of whole dates look shorter and it's easier to read them. Also, we have something like graph on the left side off. Get log. It shows us how we create new commits. For example, here, fixed register is a nuclear meat that we created on another branch. And then this committee was merged back in the main branch. There are also GM as a get merge are less than G d as a g dif honest and g b as anomalous. Forget branch. This is basic I'll s is so I won't show them in their sage or sea and get conflict once again one off the other nice islands of the time Using is GNB, which means Gignoux Branch. It's a little bit easier to understand what this command does and not get check out minus b and then the name off the branch. This is basically not understanding a tall and I can't say what this command is doing. Indeed, without checking, the dog's basically here GNB and the name off the bridge, for example. Food will create for us new branch and will switch us there. So basically here is GNB and this is the island's forgive new branch. And here in Gate I have n b, which is just check out my nose. Be nothing special, but it's easier to not forget this command. As I said previously, I am mostly using on Lee gets stash to stash something and get stash pop toe Get this from stash. So here a to my commands G S t means get stash and GSP means get stash pop, which are the same but just small, easier to remember are less is also the same way I am doing with Get cherry pick. And as you remember, this is the command to just corporate one commit and put it on another branch. So here, instead of keep cherry pick, I can just like G she p and then the i d off the comedian. This is just a smaller or less. There is also one Get Ahlers that I'm not using that often, but it is really handy. It's keyed recent branches. As you can see here, we'll get a list of our branches that were used recently and here in my Get Kontic, we confined recent branches and this is the magic get command where we find last 15 branches and saw them by camion date and we get them from a region. So basically this command is really not easy to remember and type. That's why is just recent branches, and it's really nice to use it when you switched some branches like five times and you don't remember the exact name so you can just get your recent branches. My last command is the simplest one. It allows me to just write J instead off get. And here you can see in this age, it's just Alice J. Forget when they need to use some get command, which is not in my Allah sleaze, which means I'm not using it that often. For example, Gitcho. I should not type like it show and then the a d. But I can just type g show and then they d And as you can see here, we get the message. That argument is not correct, and this a d does not exist. But actually here G is an honest forget. So this where the most popular are less is I'm using. But my main point here is that nobody except me, can use. My Eilis is fast and productively. Every person should create his own list of fire glasses, which are comfortable only for him and council get allows us to do it really easy. And I showed my islands is mostly to share main ideas off creating your own analysis. 20. Prettify git with diff so fancy: you might be wondering why my terminal looks different from yours. I am using their staged, as I said previously, with custom colors and custom configuration, for example, you can see a branch name here on the right, and it is rendered. Also buys a stage in my console. You can't unit by yourself just by Googling is the sage Is there sage themes or my there sage like week, but a little bit heavy solution. But it's not a part off this serious. In this video, I want to talk about different tool that I'm using. As you can see, my Dief is better highlighted than default ones. So basically, if we open some file and make some quick changes and then we say file, you can see in good dif that it is better highlighted than default one and you can also see that was right dark text. It is skylighted what was deleted and actually I am using special library which is called get dif so fancy and you can install it in many possible ways. Here it is deep, so fancy. Here is the repo and basically on the left side you can see how it looks without this blag in. So basically all colors are quite dark, and it's not that bright like, for example, on the right side, also on the right side, parts that were added or modified. Ah, highlight with red or green. So it's really easier to understand what's going on. So I recommend this package for everybody who are using Get in council. There are a lot of ways off in style in get defensive, but basically it's just a shell script that you should put in some off your directories, and it will just work. For example, on Mac, you can install it with brew like brew install and then dif so fancy I have already installed it. You can also do it with NPM like NPM, install miners G and then dif so fancy. This will also work after installation, we should configure our global def so fancy configuration in core pager. So basically it's enough to just run this command, and then def, so fancy will be automatically configured. Also is there are some highlighted colors, which are better than default once I'm using colors exactly from here. So basically it's enough to just copy everything and based in your console, and all these colors will be applied globally in your inky def con flick