Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out who force pushed in git?

Tags:

git

Someone used git push --force but I can't tell who did it from the logs. Is there a way to identify the culprit?

like image 892
glevine Avatar asked Feb 22 '13 16:02

glevine


People also ask

What is git push -- force?

The --force option for git push allows you to override this rule: the commit history on the remote will be forcefully overwritten with your own local history. This is a rather dangerous process, because it's very easy to overwrite (and thereby lose) commits from your colleagues.

How do I see push history in GitHub?

Viewing a repository's push logsNavigate to a repository. In the upper-right corner of the repository's page, click . In the upper-right corner of the page, click Security. In the left sidebar, click Push Log.

How do you force push?

To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch).


1 Answers

Update Nov. 2018: if you are pushing to a centralized Git repository hosting service like GitHub, then you would be able to see who has forced push your branch. But only because GitHub has chosen to surface that event in its GUI.

https://pbs.twimg.com/media/DsJIVxtU4AAreMW.jpg:large

See more at "Find committer of a force push on GitHub".


Original answer 2013:

As I mention in "Distributed Version Control Systems and the Enterprise - a Good mix?", there is no authorization or authentication with Git alone.

You need an authorization layer like Gitolite in order to keep track of who does what. (Gitolite comes with its own audit trail mechanism).

But if your repo is accessible through file (or local) protocol, then you cannot know who forced pushed.

polygraph(from motivationalgenerator.com, and wikipedia)

like image 62
VonC Avatar answered Sep 19 '22 04:09

VonC