Master Git Essentials and Branching Strategy.

Master Git Essentials and Branching Strategy.
  1. Create a directory and move to directory and create a file and add content ,then initialize git using the following command.

  1. To keep track of the file we need to add file and using git status we can see the status of it.

  2. After that make changes to the file and using git status we track the status .

  3. Then add the file and make a commit with a message and you can see the log using the following command.

  1. Adding a new feature separately by creating a new branch and then move to the file and make changes to the file, you can see the changes made exactly using

    git diff.

  1. Check status ,(now you are in new branch) and add changes and then make a commit with the message .

  1. You see that the commit is added to the log of new branch but it will be only present in the new branch (commit) and will not be there in master branch.

  1. Now move to master branch and see the log , you will not see the previously made commit as it made in the new branch.

  1. Now I need to merge the changes made in the new branch to master branch, for that I need to move to master branch and by using cherry pick and the commit id of the previous commit made in new branch with the below command (the changes are added to master branch).

This is how git is used in industry , we usually have branching strategy where we have different branches like master branch where we have active development going on and we also have feature branch which is used to add new features and we have release branch which is used to move the code to the customer. And that's all for Today.

Happy Learning.