Thread (1 message) 1 message, 1 author, 2016-08-04

Re: Problem with two copies of same branch diverging

From: Junio C Hamano <hidden>
Date: 2016-08-04 17:28:31

Ed Greenberg [off-list ref] writes:
Hi, Thanks for reading my question.

I have two copies of code checked out at the same branch. Desktop and
remote server.

I use an IDE that automatically SFTP transfers each save from the
desktop to the remote server, so I can run my changes on the server
environment.
You are syncing _ONLY_ the working tree state without syncing Git
state at all, and that is why the server side gets confused.  You
have to stop doing that.

If you do not do any change on the server end, you can simply stop
having a git repository there; just treat its directory as what it
really is: a copy of the working tree, something akin to an
extracted tarball.

If you do change on both, you probably are better off without the
mechanism to copy working tree one-way that you currently have.
Just push or fetch between the two repositories and integrate the
local changes.

Having said all that.
At the end of the session, I commit the code on my desktop, do a git
push to the repo.
When I look at the server, the code there is identical to what's on my
desktop box and what I just comitted and pushed, but, of course, git
status thinks it's all modified and wants me to either commit it or
stash it.  
This is expected as pushing into the remote would not affect what is
checked out, most importantly, the index.  But this ...
In fact, doing a git log on the server doesn't show my
latest push.  
... indicates that you are not pushing to update the remote
repository correctly.  Once you get that part working correctly,
after you push at the end of the session, you should be able to do
"git reset" at the other side to tell Git to notice that the updated
working tree files that were transferred behind its back are now in
sync with what is supposed to be checked out.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help