git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ed Greenberg <edg@greenberg.org>
Cc: git@vger.kernel.org
Subject: Re: Problem with two copies of same branch diverging
Date: Thu, 04 Aug 2016 10:28:07 -0700	[thread overview]
Message-ID: <xmqqshuk4f6g.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <0aab65de-21a3-eb48-c5b0-3e36d924348a@greenberg.org> (Ed Greenberg's message of "Thu, 4 Aug 2016 11:08:34 -0400")

Ed Greenberg <edg@greenberg.org> 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.

  reply	other threads:[~2016-08-04 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 15:08 Problem with two copies of same branch diverging Ed Greenberg
2016-08-04 17:28 ` Junio C Hamano [this message]
     [not found]   ` <36ecaea6-5f09-25fd-ffa7-61bdaf91414d@greenberg.org>
2016-08-04 17:57     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqshuk4f6g.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=edg@greenberg.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).