How to check if one file is newer than another in git?

Member

by rollin , in category: Third Party Scripts , 9 months ago

How to check if one file is newer than another in git?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , 9 months ago

@rollin 

You can compare the timestamps of two files in git to check which one is newer using the following command:

1
git log -1 --format="%at" -- <file_path>


Replace <file_path> with the path to the file you want to check. This command will give you the timestamp of the latest commit that modified the file. You can compare the timestamps of two files to determine which one is newer.

Related Threads:

How to replace one git branch with another?
How to transfer one repo to another repo in git?
How to remove a tag from newer commits in git?
How to pass value from one controller to another in laravel?
How to insert data from one table to another in laravel?
How to copy data from one canvas to another?