git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Technext <varuag.chhabra@gmail.com>
To: git@vger.kernel.org
Subject: Identifying user who ran “git reset” command
Date: Fri, 20 Feb 2015 21:46:29 -0700 (MST)	[thread overview]
Message-ID: <1424493989740-7625788.post@n2.nabble.com> (raw)

I came across a problem recently. One of the developers committed some
changes in a branch. When he checked the branch log (git checkout branch;
git log), the commit (say, abc) was showing up but when he checked the log
for a file (git log <file_name>), which was part of the given commit (abc),
the associated commit (abc) was not showing up; instead, an older commit id
(say, xyz) was there.

When the issue came to my notice, I tried using "git log --follow
<file_name>" to check complete history of a file just to make sure whether
the file was renamed to its current name. The output of "git log --follow
<file_name>" was actually showing the commit id (abc) that was missing in
the output of "git log <file_name>" command. On asking developer whether the
file was renamed, i came to know that no renames were done ever for that
file. This was confusing and i was stuck because i was not able to figure
out what happened. Later, it turned out that another developer while pushing
his code encountered merge conflict and instead of resolving it, he simply
did a "git reset ." and the HEAD got shifted.

Q.1) Is there any way i could have figured out about the "git reset" command
that the other developer executed on his machine? FYI, i have admin access
to Git.

Q.2) Is there any way we can control such things from happening in future?
I’m not sure whether this can be controlled using hook because this is not a
‘push’ command. It's something that's being done just before push. Please
correct me if I’m mistaken. The biggest problem that I see here is that
every developer has the rights to commit, which I feel is not right. I feel,
even restricting it cannot be foolproof but it can certainly bring down such
occurrences significantly. Any suggestions?



--
View this message in context: http://git.661346.n2.nabble.com/Identifying-user-who-ran-git-reset-command-tp7625788.html
Sent from the git mailing list archive at Nabble.com.

             reply	other threads:[~2015-02-21  4:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-21  4:46 Technext [this message]
2015-02-21  4:58 ` Identifying user who ran “git reset” command Junio C Hamano
2015-02-21  5:16   ` Technext
2015-02-23 16:48     ` Kevin Daudt
2015-02-23 18:43       ` Identifying user who ran "git reset" command Randall S. Becker
  -- strict thread matches above, loose matches on Subject: below --
2015-03-26  6:30 Identifying user who ran “git reset” command Gaurav Chhabra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424493989740-7625788.post@n2.nabble.com \
    --to=varuag.chhabra@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).