Put the option git config receive.denyCurrentBranch ignore

  1. I make a change on my LAN.
  2. Pour from my PC to the server in the master brunch directly http://clip2net.com/s/j885ch
  3. The commits between LAN and server match 2ddb99ce287d56d3d3ace177da0380ac8ccbdea2, if I re-do push, it writes, everything is OK http://clip2net.com/s/j887Ma
  4. But for some reason, the server writes http://clip2net.com/s/j8897l , that the file has been changed, although the commit has passed.
  • Would take a diff and see what's wrong on the server. Have you changed this file on the server too? - KoVadim
  • On the server did not change the file. That's the thing. - Onikys
  • did you watch diff? (git diff on server). It will show what is wrong in the file. It is possible that there are line breaks. But do not think that if you have launched changes from your machine, they should change on the server in the "working directory". - KoVadim
  • Until, it sees the changes that I made. But why does it write the status of the file modified. It turns out that I need to make another commit but already on the server so that the brunch is clean? I just do not understand this: On LAN, when I push to the server, the brunch is clean, and on the server, the modified html_block.xml. Maybe the option is to have a special push to push it in exactly the same way. - Onikys
  • I think that you do not fully understand the difference between a working copy and a repository. You have a file modified in the working copy on the server. In fact, it is not very nice to climb into the files on the server. But if necessary, do only pull. I can explain why you are observing so much, but it will drag on a thousand words. I can only recommend re-reading articles on git. - KoVadim

1 answer 1

The essence of the author’s misunderstanding of the issue is reflected in the questions in the comments:

I can't understand why when I push from lokalki to the server, then on the server, as a result, there is not an exact copy of the file, but some statuses of modified html_block.xml, after which I have to do git reset

KoVadim's answer: Because pushing to the server does not change the working copy on the server

Why then, if I did push to branch develop and then switch, the develop branch would be identical

because the " checkout " changes the working copy of the files (as well as the "reset" (above)).


in general, the correct answer can be considered a tip: push only in the bare repository ; do not push to the repository, near which the working copy of the files is deployed: they will not change .

  • You can still push into another branch, and then merge into the current one. - tonal