1

The git log and git whatchanged shows 2 commits, but both have same lines added, so where was it removed inbetween so it allwed adding same changes again?

I tried the below command, how can there be 2 commits having the same 2 lines added, when there is not a single commit inbetween which show the lines as removed. How to i find what happened to this file, inbetween these 2 commit?

git log --stat --follow -p at_Objects/AtResctrCase.cpp

commit 914f8e87cb88e2923ed089a579d69cfa21ae0bc4

at_Objects/AtResctrCase.cpp | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)

 seller_bid_amount.clear(); //F 27116 auction_items.clear(); + //F-41959 + store_id.clear(); 

commit 6fe48ea09abae01a9bfea37e6ccf8e6c6fb360c2

at_Objects/AtResctrCase.cpp | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)

 auction_items.clear(); //F-39023 is_acm_case = false; + //F-41959 + store_id.clear(); 

git diff 6fe48ea09abae01a9bfea37e6ccf8e6c6fb360c2^..914f8e87cb88e2923ed089a579d69cfa21ae0bc4 -- at_Objects/AtResctrCase.cpp

diff --git a/at_Objects/AtResctrCase.cpp b/at_Objects/AtResctrCase.cpp index 91fe41a..878d184 100644 --- a/at_Objects/AtResctrCase.cpp +++ b/at_Objects/AtResctrCase.cpp @@ -32,4 +32,6 @@ void AtResctrCase::clear() auction_items.clear(); //F-39023 is_acm_case = false; + //F-41959 + store_id.clear(); } 

Doing a "git log" i found a few commits inbetween and checked whether this file was modified in any of the commit. in the order of Recent to oldest. Found the commit where the line was removed. b4eec3024a18bd502735d88c31891eea646d3356 Merge: 9a74a46 66cc3f1. But why it should be removed when no other commit inbetween modified this file? Did the automerge remove the line? if this file was removed in the merge commit, why it didnt show up in "git log --stat --follow -p at_Objects/AtResctrCase.cpp" OR "git diff". Any suggestions much appreciated.

$ git show -m --name-status 914f8e87cb88e2923ed089a579d69cfa21ae0bc4 | grep AtResctrCase.cpp M at_Objects/AtResctrCase.cpp $ git show -m --name-status 914f8e87cb88e2923ed089a579d69cfa21ae0bc4:at_Objects/AtResctrCase.cpp | grep F-41959 //F-41959 

In the above commit the line was manually re-added.

$ git show -m --name-status 62a3731fbc1d008342ac72614faaf7fd9e7e312b | grep AtResctrCase.cpp $ git show -m --name-status 8a8de0663381f70677d6685d4ae214becd1f4310 | grep AtResctrCase.cpp $ git show -m --name-status **b4eec3024a18bd502735d88c31891eea646d3356** | grep AtResctrCase.cpp M at_Objects/AtResctrCase.cpp $ git show -m --name-status b4eec3024a18bd502735d88c31891eea646d3356:at_Objects/AtResctrCase.cpp | grep F-41959 

The line F-41959 has been removed here.

commit b4eec3024a18bd502735d88c31891eea646d3356 Merge: 9a74a46 66cc3f1

$ git show -m --name-status **9a74a46a47e425e35bc73a532a374ab5e67ec478** | grep AtResctrCase.cpp $ git show -m --name-status **66cc3f136c91c2fb7c71915a1dbd4fbf9facf761** | grep AtResctrCase.cpp $ git show -m --name-status 50b5cfac734f3a4231e60144d6223d68412900b5 | grep AtResctrCase.cpp M at_Objects/AtResctrCase.cpp $ git show -m --name-status 50b5cfac734f3a4231e60144d6223d68412900b5:at_Objects/AtResctrCase.cpp | grep F-41959 //F-41959 

The above commit is where the lines were initially added

6
  • Are you sure that those 2 lines are located at the exact same place in the code? Commented Dec 7, 2011 at 12:03
  • Not exactly in the same lines, but these 2 commits are the only ones when i do gitwhatchanged, i have updated the lines before it. it should not show the + sign even if it was moved to another line right? Commented Dec 7, 2011 at 12:12
  • I mean you could had the same lines several times at different places in the code. The question is : after the first commit and after the second commit, are the two files really identical? Commented Dec 7, 2011 at 12:14
  • Did you do a rebase/merge recently? Commented Dec 7, 2011 at 17:23
  • Am not sure about that, but got more information from "git log", Saw few more commit but none of them touched this file except a merge commit which removed and looks weird. Commented Dec 8, 2011 at 5:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.