How to apply or rollback a git patch or git diff code changes?

say you patch file is myfix.diff.

To apply code changes

git apply   myfix.diff

To rollback a complete git patch

git apply   -R myfix.diff

To rollback change to a particular file

git checkout <filename>

How to do git merge?

say you are in branch1 and branch2 has the new code changes.

git merge branch2

This takes the code changes in branch2 and puts them in branch1.

How to take last commit code details?

Commit details include username, user commit note, time and hashid.

Code details, as name details include code differences.

For last `commit` code changes use

git show

For last but one or say from last second commit

git show HEAD~1

For last but second or say from last third commit

git show HEAD~2

How to show in a concise way of looking at git commits?

git log --pretty=oneline