What is the difference between the code and the git

2023-4-11 15:55 Originated from this website 3,614 five ten
[Abstract]

But sometimes I find a problem. When I want to compare the code copied from other places with my own version, I find that all the codes are different. In fact, others only modify a few of them; Excluding the part of the code that you modified, the rest has not changed at all, so why does git prompt for changes?

Git must be very familiar to many development partners, and it is also a very efficient tool for version management. Especially when comparing the differences between the current version and the historical version, the git diff command can intuitively see what has been modified. I am used to lazy people's usage, and I directly use the git tool of the vscode tool to shortcut.

But sometimes I find a problem. When I want to compare the code copied from other places with my own version, I find that all the codes are different. In fact, others only modify a few of them; Excluding the part of the code that you modified, the rest has not changed at all, so why does git prompt for changes?

代码明明没有变化 git却显示有差异是怎么回事

This is due to the change of filemode. Some bits of the chmod file have changed. If you strictly compare the original file and the chmod file, there is a difference between the two. But the source code usually only cares about the text content, so the changes caused by chmod should be ignored. So, set the following:

Switch to the root directory of the source code,

 git config --add core.filemode false

 

Check again at this time. There is no abnormal reminder. Go to work happily

This article was last updated on April 11, 2023, and has not been updated for more than one year. If the article content or picture resources are invalid, please leave a message for feedback, and we will deal with it in a timely manner. Thank you!

If you think this article is helpful, please sponsor this website

 Alipay scanning sponsorship WeChat scanning sponsorship

  • Alipay scanning sponsorship
  • WeChat scanning sponsorship
  • Statement: All text, pictures and other materials marked "Original on this site" are copyrighted Yaxi All, welcome to reprint, but please indicate the source;
    It is the latest article in this column
    Current comments: 5 of which: visitor 0 blogger 0
    Loading
    1. 2 months ago (03-28) 0F

      The certificate has expired!

    2. 4 months ago (01-15) 0F

      This problem is being solved

    3. 1 year ago (2023-05-18) 0F

      Every time you use VS, a git error is popped up. It has never been handled. It seems necessary to deal with it

    4. 1 year ago (2023-05-09) 0F

      This is a very enlightening article, and I like it very much.

    Comment

     doubt  naughty  Sad  Pick one's nose  scare  smile  lovely  A bad laugh  surprised  Daze  doubt  Soldiers  Snicker  Curse  Anger  roll one's eyes  applause  proud  Wipe away sweat  kiss  Cry  open the mouth and show the teeth  halo  strong

    share five ten 3,614
    Top