Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know the list of commits / changes before I push

Tags:

git

git status shows that I have 2 commits

# On branch production
# Your branch is ahead of 'origin/production' by 2 commits.
#

but git diff shows nothing

like image 246
Joe Avatar asked Jan 15 '23 19:01

Joe


1 Answers

git diff doesn't, by default, show you anything from previous commits. You should use git log for that. To show the last two commits, use git log -2.

To compare commits with each other using diff, the syntax is git diff commit1 commit2. For example, to show you all the changes that occurred between two commits ago and now, type git diff HEAD^2 HEAD.

like image 67
Hubro Avatar answered Jan 29 '23 06:01

Hubro