#git add.
#git commit -m "merge conflict fixed"
[master fe8f42d] merge conflict fixed
Comparing Commits with diff
The diff command is one of the most powerful Git tools.
It allows you to compare files and text to see which you
want to use if there are multiple options. The ability to
compare specific commits in Git makes it easier to know
what to keep and what to discard between two similar
versions of code.
The diff command takes two sets of inputs and outputs
the differences or changes between them. This is its
syntax:
Click here to view code image
git diff [--stat] [branchname or commit]
git diff looks at the history of your commits, individual
files, branches, and other Git resources. It’s a very useful
tool for troubleshooting issues as well as comparing code
between commits. It has a lot of options and command-
line parameters, which makes it a bit of a Swiss Army
knife in terms of functionality. One of the most useful
functions of diff is to be able to see the differences
between the three Git tree structures. The following are
variations of the git diff command that you can use:
git diff: This command highlights the differences between your
working directory and the index (that is, what isn’t yet staged).
git diff --cached: This command shows any changes between the
index and your last commit.
git diff HEAD: This command shows the differences between your
most recent commit and your current working directory. It is very
useful for seeing what will happen with your next commit.
The following is an example of executing git diff --
cached after text2 is added to the index: