{"thread":{"id":"20901","subject":"git push stages original version on server","startedAt":"2009-09-11T10:40:16Z","lastAt":"2009-09-11T11:11:18Z","messageCount":3,"participants":["Roald de Vries","Paolo Bonzini","Mikael Magnusson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122881","messageId":"D7E5118C-AE88-4C4B-8D8A-5AF16ECF731D@roalddevries.nl","threadId":"20901","inReplyTo":null,"subject":"git push stages original version on server","fromName":"Roald de Vries","fromEmail":"rdv@roalddevries.nl","sentAt":"2009-09-11T10:40:16Z","receivedAt":"2009-09-11T10:40:16Z","isPatch":false,"sender":{"key":"rdv@roalddevries.nl","avatar":null},"body":"Hi all,\n\nThere's a thing I don't understand: I have a repository on a server  \nfrom/to which I pull/push. But when I push to it, and do a checkout on  \nthe server, the pushed changes are not visible. It appears that the  \nchanged file is added to the index on the server automatically. Why is  \nthis? It seems dangerous. If I do a commit on the server, the changes  \nfrom the client will be lost.\n\nThere's also a thing I'm not sure exists: I use a git server/client  \nsetup for developing a website. I would like git-pushes to appear  \nimmediately online (without having to ssh to the server and checking  \nout manually). Is this possible?\n\nMy questions are:\n- Why does git work like this?\n- Can I change its behaviour (if I still want that after the answer to  \nthe previous question)?\n- How can I have git automatically checkout pushed changes on the  \nserver?\n\nThanks in advance.\n\nKind regards,\n\nRoald\n"},{"id":"122882","messageId":"4AAA2FE7.5020802@gnu.org","threadId":"20901","inReplyTo":"D7E5118C-AE88-4C4B-8D8A-5AF16ECF731D@roalddevries.nl","subject":"Re: git push stages original version on server","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2009-09-11T11:09:27Z","receivedAt":"2009-09-11T11:09:27Z","isPatch":false,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"Pushing to a non-bare repository is discouraged.\n\n> - How can I have git automatically checkout pushed changes on the server?\n\nI think you could in principle add a hook that does the \"git checkout\" \nor \"git reset --hard $(git symbolic-ref HEAD)\", but I suggest pushing to \na bare repository and have the hook trigger a \"git pull\" elsewhere.\n\nPaolo\n"},{"id":"122883","messageId":"237967ef0909110411u34010660w2fda90d5bba1e9dc@mail.gmail.com","threadId":"20901","inReplyTo":"D7E5118C-AE88-4C4B-8D8A-5AF16ECF731D@roalddevries.nl","subject":"Re: git push stages original version on server","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2009-09-11T11:11:18Z","receivedAt":"2009-09-11T11:11:18Z","isPatch":false,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"2009/9/11 Roald de Vries <rdv@roalddevries.nl>:\n> Hi all,\n>\n> There's a thing I don't understand: I have a repository on a server from/to\n> which I pull/push. But when I push to it, and do a checkout on the server,\n> the pushed changes are not visible. It appears that the changed file is\n> added to the index on the server automatically. Why is this? It seems\n> dangerous. If I do a commit on the server, the changes from the client will\n> be lost.\n>\n> There's also a thing I'm not sure exists: I use a git server/client setup\n> for developing a website. I would like git-pushes to appear immediately\n> online (without having to ssh to the server and checking out manually). Is\n> this possible?\n>\n> My questions are:\n> - Why does git work like this?\n> - Can I change its behaviour (if I still want that after the answer to the\n> previous question)?\n> - How can I have git automatically checkout pushed changes on the server?\n>\n> Thanks in advance.\n>\n> Kind regards,\n>\n> Roald\n\nhttp://git.or.cz/gitwiki/GitFaq#Whywon.27tIseechangesintheremoterepoafter.22gitpush.22.3F\n\n-- \nMikael Magnusson\n"}]}