{"thread":{"id":"43005","subject":"Problem with two copies of same branch diverging","startedAt":"2016-08-04T15:16:54Z","lastAt":"2016-08-04T17:57:56Z","messageCount":3,"participants":["Ed Greenberg","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"293086","messageId":"0aab65de-21a3-eb48-c5b0-3e36d924348a@greenberg.org","threadId":"43005","inReplyTo":null,"subject":"Problem with two copies of same branch diverging","fromName":"Ed Greenberg","fromEmail":"edg@greenberg.org","sentAt":"2016-08-04T15:08:34Z","receivedAt":"2016-08-04T15:16:54Z","isPatch":false,"sender":{"key":"edg@greenberg.org","avatar":"https://gravatar.com/avatar/d92c2e6aa2a0a80cc9a3492aa2d13ff98a73c5d420bfe98d51b9ba467ce10706?d=mp&s=160"},"body":"Hi, Thanks for reading my question.\n\nI have two copies of code checked out at the same branch. Desktop and \nremote server.\n\nI use an IDE that automatically SFTP transfers each save from the \ndesktop to the remote server, so I can run my changes on the server \nenvironment.\n\nAt the end of the session, I commit the code on my desktop, do a git \npush to the repo.\n\nWhen I look at the server, the code there is identical to what's on my \ndesktop box and what I just comitted and pushed, but, of course, git \nstatus thinks it's all modified and wants me to either commit it or \nstash it.  In fact, doing a git log on the server doesn't show my latest \npush.  So I need to pull the changes, but I can't because I have pending \nstuff.\n\nWhat's a good git workflow for this save-upload-remote test cycle?\n\nThanks,\n\n-- \nEd Greenberg\nGlens Falls, NY USA\n\n"},{"id":"293106","messageId":"xmqqshuk4f6g.fsf@gitster.mtv.corp.google.com","threadId":"43005","inReplyTo":"0aab65de-21a3-eb48-c5b0-3e36d924348a@greenberg.org","subject":"Re: Problem with two copies of same branch diverging","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-04T17:28:07Z","receivedAt":"2016-08-04T17:28:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ed Greenberg <edg@greenberg.org> writes:\n\n> Hi, Thanks for reading my question.\n>\n> I have two copies of code checked out at the same branch. Desktop and\n> remote server.\n>\n> I use an IDE that automatically SFTP transfers each save from the\n> desktop to the remote server, so I can run my changes on the server\n> environment.\n\nYou are syncing _ONLY_ the working tree state without syncing Git\nstate at all, and that is why the server side gets confused.  You\nhave to stop doing that.\n\nIf you do not do any change on the server end, you can simply stop\nhaving a git repository there; just treat its directory as what it\nreally is: a copy of the working tree, something akin to an\nextracted tarball.\n\nIf you do change on both, you probably are better off without the\nmechanism to copy working tree one-way that you currently have.\nJust push or fetch between the two repositories and integrate the\nlocal changes.\n\nHaving said all that.\n\n> At the end of the session, I commit the code on my desktop, do a git\n> push to the repo.\n\n> When I look at the server, the code there is identical to what's on my\n> desktop box and what I just comitted and pushed, but, of course, git\n> status thinks it's all modified and wants me to either commit it or\n> stash it.  \n\nThis is expected as pushing into the remote would not affect what is\nchecked out, most importantly, the index.  But this ...\n\n> In fact, doing a git log on the server doesn't show my\n> latest push.  \n\n... indicates that you are not pushing to update the remote\nrepository correctly.  Once you get that part working correctly,\nafter you push at the end of the session, you should be able to do\n\"git reset\" at the other side to tell Git to notice that the updated\nworking tree files that were transferred behind its back are now in\nsync with what is supposed to be checked out.\n"},{"id":"293109","messageId":"CAPc5daU7cyUNYOPbg1cYrkvCzYZ9xCsx4MhSZRHaeoXy9Ltcrg@mail.gmail.com","threadId":"43005","inReplyTo":"36ecaea6-5f09-25fd-ffa7-61bdaf91414d@greenberg.org","subject":"Re: Problem with two copies of same branch diverging","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-04T17:57:28Z","receivedAt":"2016-08-04T17:57:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Thu, Aug 4, 2016 at 10:50 AM, Ed Greenberg <edg@greenberg.org> wrote:\n> On 08/04/2016 01:28 PM, Junio C Hamano wrote:\n>>\n>> ... indicates that you are not pushing to update the remote\n>> repository correctly.  Once you get that part working correctly,\n>> after you push at the end of the session, you should be able to do\n>> \"git reset\" at the other side to tell Git to notice that the updated\n>> working tree files that were transferred behind its back are now in\n>> sync with what is supposed to be checked out.\n>\n> If this is the case, why do my fresh clones contain the most recent commit?\n\nExactly. Why does your \"push\" not result in \"git log\" to show the\nmost recent commit? Once you solve that, \"git reset\" would do\nthe right thing, I would think, just like a fresh clone shows the\nlatest.  The thing is, that I didn't quite find out what your \"push\"\nis doing wrong in your original message.\n"}]}