The −−name−status flag can be used with the diff tool to show both the file name and its status. If we don't want to see the detailed differences, but need to know only what files are different use the −−name−only. This will give a very detailed difference. The following command lists differences in files in the current branch (master) and the feature branch. The syntax to use the diff tool is − $ git diff ![]() If we want to compare two branches on the basis of changes that have been performed on the files, we need to use the diff tool. The output is shown below − e0ccfce (feature) howdy file addħ1b4d39 how are you added Listing File Differences The following command compares two branches and returns the commits that are present in the feature branch but are unavailable in the master branch. The syntax to list commit differences using the git log command is given below − $ git log. txt Listing Commit DifferencesĪt some point in time the feature branch has to be merged to master, as it is our main line of work. $ git log −−oneline feature −−all −−graph There are two branches emerging from the initial commit, the master branch on the left and a feature branch on the right. In the output given below ‘*’ denotes a commit and we could see that there are 4 asterisks which means there are 4 commits. The following command can be used to get a similar graphical representation of branches. From the diagram, it is clear that initial commit hash is “9260faa” Each commit and their corresponding commit message are shown in the diagram. Listing file changes − This method compares branches and displays how exactly a certain file is different in the two branches.įrom the below diagram we can easily understand that there are two branches in the repository one is the master and the other is a feature branch. Listing commit differences − This method shows commits that are present in a branch but unavailable in the other branch. ![]() We will see a couple of different ways to compare two branches − It is important that we compare the differences in the branches before merging to avoid any conflicts. At some point in time, we may have to merge these branches in order to have the resulting work in the main branch. Collaborators will use multiple branches in order to have clearly separated codebase.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |