So what’s the difference with the previous command? In order to compare two branches, you can also use the “git diff” command and provide the branch names separated by three dots. Git is using a color code in order to display differences done between two branches: lines in green are lines added to the files and lines in red are the ones that are deleted from the files.Īlso See: How To Switch Branch on Git Comparing two branches using Triple Dot Syntax $ git diff master.featureĪs you can see, one file has been added to the branch. In order to see what has been modified between master and feature, you would run the following command. Let’s say for example that you are looking to see the differences between a feature branch (being one commit ahead of master) and the master branch. How To Set Upstream Branch on Git | What is a Git Upstream Branch? | Git Set Upstream Branch without Push.How To Create and Apply Git Patch Files | Creating & Applying Git Patch Files with Different Git Commands.How To Clean Up Git Branches | Git Clean Up Local and Remote Branches.In short, it will show you all the commits that “branch2” has that are not in “branch1”. Using this command, Git will compare the tip of both branches (also called the HEAD) and display a “diff” recap that you can use to see modifications. There are various ways to compare git branches and some of them are listed & explained here in detail.Ĭompare two branches using git diff with Double Dot Notationįor comparing two branches easily, you have to use the “git diff” command and provide the branch names separated by dots. You need to view all changes that are different from “main” – to get an idea of what would be integrated if you performed e.g. Let’s say you’d like to take a look at a feature branch named “feature/login”. Compare Specific File Between Two BranchesĬomparing Actual Changes Between Two Branches.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |