![]() So, we create a new branch from the master branch, let’s call it a ‘feature branch. Now, we don’t want to touch the master branch code, we want to copy the code of the master branch to a new place, where we can experiment or change the code. So, the website we showed you above is the master branch. By default, all your code is stored on a master branch. So, in git to isolate different versions of code we have branches. Make changes in the code, and then once the changes are finalised, you will replace the code in the main folder right? Let us understand how we can do the above thing in git. ![]() So, what do you do? Ideally, you will copy the code of this website in a new folder. But if you are changing the code, you do not want the changes to be reflected in the main website which is deployed. For this, you will have to change the code of the website. You want to add more features to this website. The website looks something like this.įig 3: Sample example of the website before changes Let us take an example to understand this, Let’s say you have a website that is currently running. So whenever we make any change, it generates a new commit.įig 2: The changes made in the repository will be saved as a new commit with a new commit id What is a Branch?Ī Branch is a representation of different isolated versions of code. These changes in git will be saved as another commit with another commit-id 14343. Now let us say we have made some changes to the code by adding another python file. Each commit has a commit-id, let it be 1234 in our case. These four python files will be saved inside a commit. In Fig: 1, Let us assume that we have four python files. Let us take an example and discuss in brief from the diagram shown below:įig 1: The changes made are saved in a commit What is a Commit?Ĭommit is defined as the location where the code and its changes are stored. Let’s understand these two terms respectively. How can Git Rebase and Git Merge be used together?įor understanding the working of git, we need to understand the two fundamental concepts in git which is git commit and git branch.So, the following are the topics covered in this blog:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |