daniel
daniel

Reputation: 9825

Git lines getting deleted without notice

I have a remote designed and when he commits he keeps deleting lines but they don't show up in the git log, how is he doing to delete the lines but preventing git showing them ?

Let me show you an example: I added a margin: 0 30px line to one of the classes. Hours later after one of his commits the line got deleted:



   DANIEL-PALACIOs-MacBook-Air:Groupy skoda306$ cat public/stylesheets/sass/custom.sass | grep "margin: 0 30px" 

This produces no output, but I can see clearly in the log that I added the line


DANIEL-PALACIOs-MacBook-Air:Groupy skoda306$ git log -S"margin: 0 30px" public/stylesheets/sass/custom.sass 
commit 72e32eb415ca2282dffb89f7f6174c0f7136e2d5
Author: Daniel Palacio 
Date:   Sat Apr 9 15:17:39 2011 -0400

    Changed the buy button to make it bigger

But git never shows when the line was deleted, how is he doing it ?

Sorry closing as the questing is too confusing to understand

Upvotes: 0

Views: 154

Answers (3)

sehe
sehe

Reputation: 392833

git log -S will also show if that particular text was DELETED. So, for all I know, the commit listed (72e32eb415c) might precisely be the one that deletes the line :) Now, of course I'm sure you checked that, but I thought I'd mention it. [1]

I guess

git blame -- /public/stylesheets/sass/custom.sass

should shed some more light. If you know a search pattern close to the target, do something like

git blame -L/pattern/,+5  -- /public/stylesheets/sass/custom.sass

$0.02


[1] this git bundle is proof:

base64 -d > bundle.git <<HERE
IyB2MiBnaXQgYnVuZGxlCjFjYTYyYzg4N2VhNDMxNmRlNTJmMTFmYjgxZTA4OWZlNTA3N2FkOTIg
SEVBRAoKUEFDSwAAAAIAAAAGkQ14nJWLWwrCMBAA/3OK/Atld/MGEe/gCbLJloq2lXS9v3oEfwYG
ZnSI2C4YPZe5OgqlICTK2FNMwLVxBM+Nw5yRzKsO2dQmRsm5z9S9c8iFY6DyrUKPMbTsMyHU6JKp
b132YW+iiz0fssh1FRmPqtNPpu15seiAXPmC7AkIwLR9Xe+q8udmDmn71s0H9rc8+5IKeJyVjMEN
wjAMAP+Zwn+kyklqIksIsQMTpMZRIppWSs3+lBH43T3ubKgCzZKkFOGwMHrPkgqe9Ip8VaI5UV6K
FEouf6zuA55qFW6HVn101fHONv1k2tY7+Ighcjw3cMGA6GTvvZnpn5lrW7OWV/cFxPUwvq0BeJwB
HQDi/zEwMDY0NCBhAPTL8Mk74sG76S9n4/Szffj3AZ6+wwsPlLYBeJxLTCzgysvPL+HKzUwt5qoq
LebKSi3hAgBYlgd4rQF4nDM0MDAzMVFIZJA65rLv7bKXZ0/+XDD91p3gq/99wtQBtMEOe7wBeJxL
TCzgysvPL+HKzUwt5koqyk8t4qoqLebKSi3hAgCOjwmcDdQMPXKLB94u5+xOPu4Y/ZcQw6I=
HERE

do a clone and test it

git clone bundle.git bundle
(cd bundle && git log -pSbroer)

will show both the revision adding and deleting the word 'broer'

Upvotes: 1

evgeny
evgeny

Reputation: 2584

You are looking for either git log --patch or git diff <commit_id>.

By default, git --log only shows the messages that the user committed with, but not the actual code difference.

Upvotes: 1

Alexander Gro&#223;
Alexander Gro&#223;

Reputation: 10458

Try git log --patch to see the diff for a commit. This will show the deleted lines right below the log message. I hope I understood your question correctly.

Upvotes: 1

Related Questions