| Start | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Show differences in working branch This will show the unstaged (opens new window) changes on the current branch from the commit before it. It will only show changes relative to the index, meaning it shows what you could add to the next commit, but haven't. To add (stage) these changes, you can use If a file is staged, but was modified after it was staged, |
||||||||||||||||||||||||||
Show changes between two commits E.g.: Show the changes made in the last 3 commits: Note: the two dots (..) is optional, but adds clarity. This will show the textual difference between the commits, regardless of where they are in the tree. |
||||||||||||||||||||||||||
Show differences for staged files This will show the changes between the previous commit and the currently staged files. NOTE: You can also use the following commands to accomplish the same thing: Which is just a synonym for Which will trigger the verbose settings of the |
||||||||||||||||||||||||||
| Comparing branches Show the changes between the tip of Show all changes on Using only one parameter such as git diff original is equivalent to git diff original..HEAD |
||||||||||||||||||||||||||
| Show both staged and unstaged changes To show all staged and unstaged changes, use: NOTE: You can also use the following command: The difference being that the output of the latter will actually tell you which changes are staged for commit and which are not. |
||||||||||||||||||||||||||
Show differences for a specific file or directory Shows the changes between the previous commit of the specified file ( This also works for directories: The above shows the changes between the previous commit of all files in the specified directory ( To show the difference between some version of a file in a given commit and the local Or if you want to see the version between two separate commits: To show the difference between the version specified by the hash |
||||||||||||||||||||||||||
Viewing a word-diff for long lines Rather than displaying lines changed, this will display differences within lines. For example, rather than: Where the whole line is marked as changed, You can omit the markers |
||||||||||||||||||||||||||
Using meld to see all modifications in the working directory will show the working directory changes. Alternatively, will show the differences between 2 specific commits. |
||||||||||||||||||||||||||
Show differences between current version and last version This will show the changes between the previous commit and the current commit. |
||||||||||||||||||||||||||
| Produce a patch-compatible diff Sometimes you just need a diff to apply using patch. The regular Then somewhere else you can reverse it: |
||||||||||||||||||||||||||
| difference between two commit or branch To view difference between two branch To view difference between two branch To view diff with current branch To view summary of changes To view files that changed after a certain commit To view files that are different than a branch To view files that changed in a folder after a certain commit |
||||||||||||||||||||||||||
| Diff UTF-16 encoded text and binary plist files You can diff UTF-16 encoded files (localization strings file os iOS and macOS are examples) by specifying how git should diff these files. Add the following to your
Then edit or create a This will convert all files ending in You can do similar things for other files, that can be converted to text. For binary plist files you edit and |
||||||||||||||||||||||||||
Viewing a three-way merge including the common ancestor Sets the it will include an additional section containing the original text (coming form the common ancestor): This format makes it easier to understand merge-conflict, ie. in this case locally The same resolution would have been much harder using the default: |
||||||||||||||||||||||||||
Show changes between two branches Syntax
Parameters
|
Read Article
https://develop.horje.com/learn/1434/reference