How do I check the date and time of the latest git pull
that was executed? I frequently need to know when the code changed on a server when something goes wrong.
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
Will give you a unix timestamp of the last modification of that file. Git writes the FETCH_HEAD file every time you pull or fetch, even if there was nothing to pull.
Use python:
python -c "import os;print os.stat('.git/FETCH_HEAD').st_mtime"
Cross Platform (OSX/Linux) Bash Solution
Heavily inspired by
@smooves
answer: https://stackoverflow.com/a/9229377/622276 and comments.But I am maintaining my own bash prompt git integration
With the source here: https://github.com/neozenith/dotfiles/blob/master/bash-scripts/function_parse_git_prompt.sh
msys
version in Git Bash for Windows works identical to the linux version.I'm compiling the cross platform options into a case statement. So it will fork a fetch process on any git repo I navigate into that is older than fifteen minutes since last fetch so the rest of my prompt script knows if I have stuff to pull.
Git radar used to to this but it required saving a file with timestamp of when the last fetch was called. This writes no temporary files.
git rev-parse --show-toplevel
just means if I'm anywhere in a git repo it will get the repo root so we can reference the.git
folder path.or
On a hunch, I tried "stat -c %y .git/FETCH_HEAD", and got a human-readable printout of the time:
Furthermore, you can add
when = !stat -c %y .git/FETCH_HEAD
to the[alias]
section in your ~/.gitconfig file (it's safest to do this automatically by running the following command line in any git repo)and then you are able to find this info with your new "command", anytime:
[Then it occurred to me to do "man stat", and I found that there are a bunch of other % parameters available for the 'stat' program. YMMV.]