Sometimes, you might want to compare how exactly a certain file is different in two branches. Feel free to tinker around a bit, for example by using the -oneline option to make the output a bit more concise: $ git log -oneline main.feature/login Comparing A Specific File Between Branches Git log is a command with dozens of interesting options. The solution is very similar, although we have to use the git log command in this case: $ git log main.feature/login Instead of the actual, detailed changes, you can also have Git show you the commits that are different. Tower will then start a comparison and show the differing changes in your favorite diff tool. You can simply select the branches in the sidebar, right-click, and select the "Compare." option from the contextual menu. In case you are using the Tower Git GUI, comparing branches is very easy. In most situations when you want to compare two branches, you will want to use the double dot notation, though! Git now compares the tip of our feature branch with the common ancestor commit of both branches: If you add a third dot to this notation, the comparison will be quite different: instead of comparing the tips of both branches, something else happens. This produces the same output as separating the branches with the two dot characters. Tip: you might also see notations where the two branches are separated by only a space charater (e.g. It's important to understand what exactly is being compared: using the "." notation, Git compares the tips (= latest commits) on both branches: You can see this by using the git diff command as follows: $ git diff main.feature/login You want to see 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". Comparing Actual Changes Between Two Branches
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |