Skip to contentSkip to conversation

How to view diff when doing `git push --force`

DISCUSSION KES 2 participants 3 messages Mar 11, 2017 – Jan 10, 2018

lore
Share & tools
lore

KES

author
#0 lore raw

Hi. I have done git push --force but I forget to pull,

Counting objects: 7, done.
Delta compression using up to 4 threads. Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 765 bytes | 0 bytes/s, done. Total 7 (delta 6), reused 0 (delta 0)
To xxxgit:cry/cry.git
+ 48e9058...117ee39 staging -> staging (forced update)

But I can not view diff:

git show 48e9058...117ee39
fatal: ambiguous argument '48e9058...117ee39': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

May I pull info about changes that was deleted?

#1 lore raw
Quoted 10 lines · KES

Hi. I have done git push --force but I forget to pull,

Counting objects: 7, done.
Delta compression using up to 4 threads. Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 765 bytes | 0 bytes/s, done. Total 7 (delta 6), reused 0 (delta 0)
To xxxgit:cry/cry.git
+ 48e9058...117ee39 staging -> staging (forced update)

Quoted 8 lines

But I can not view diff:

git show 48e9058...117ee39
fatal: ambiguous argument '48e9058...117ee39': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

May I pull info about changes that was deleted?

At this point, no, but in the future instead of --force use --force-with-lease=<refname>:<expect> where <expect> is e.g. $(git rev-parse HEAD).

author
#2 lore raw
Quoted 3 lines

At this point, no, but in the future instead of --force use --force-with-lease=<refname>:<expect> where <expect> is e.g. $(git rev-parse HEAD).

Thank you.

But I have found next command to see what were changed.
For example if someone did forced push and I wanna see changes before merge remote

git log --graph --decorate --pretty=oneline --abbrev-commit --cherry-mark --boundary --left-right

But is there an option to view changes in amended commits?

See the last code post about unknown option in the next answer :
https://stackoverflow.com/a/48149931/4632019

If there is no such option. Will it be useful to have it?