On Tuesday, April 26, 2022 at 3:37:29 AM UTC+1 guangy...@gmail.com wrote:

> I'm a programmer from China, and I have a question when I use git, that I 
> can't get the push time of the code. git seems to only log commit times. 


Internally (locally), git does log all the changes to references (there is 
a config setting) such as branch tips, i.e. the reflogs but these aren't 
normally considered public. (haven't double checked that remotes are 
logged..)
 

> For example, if a colleague of mine commits the code to the local 
> repository on Sunday, and does not push it to the remote repository until 
> next Tuesday. 


That (commit time) is by design. Git is distributed, so control is 
distributed to the user. They can push (publish) at any time they like, 
independent of the time at which the idea/code was recorded (e.g. sign off 
for copyright and all that legal stuff).
 

> As an operation and maintenance, if I pull on Monday, I will not get any 
> updates. Wait until I do a pull on Tuesday and I'll get an update. But I 
> found that git log records the commit time and the date is Sunday.


If you have operational access to the server, or are linked to the server 
owner, you could organise that you get notification, but by design that is 
outside how Git operates - It was designed to support the Linux development 
process, which is far more distributed, open and ad-hoc than most 
organisations.
 

> Unless the developer tells me that he pushes on a Tuesday, I won't know 
> when he pushes. In response to this question, please answer it, or record 
> the push time on git. I think this may be easy to implement and necessary. 


It's not quite as easy as that when the whole eco-system is considered. 
What if the same repo is pushed to many servers (as git.git itself does), 
what time should one record (one at each server, or at source), and which 
one becomes the authoritative value? I could fetch/pull from all of those 
public servers and get identical *content*, but different fetch/pull times 
- as far as the repo's code goes, I don't care what time the fetch/pulls 
happen as long as the content is *identical*  (i.e. the remote refs all 
point at identically the same commit hash).

It may be that the git server capability could provide a last ref update 
time, but someone (you/your employer) would need to propose some code, 
along with a strong rationale that balances security, and all the other 
factors.
 

> Looking forward to your answers. thank you very much.
>

Summary: by design, such times are not considered important.

Philip 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/95016858-0ca2-4349-878d-851fc4437896n%40googlegroups.com.

Reply via email to