git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Problem with two copies of same branch diverging
@ 2016-08-04 15:08 Ed Greenberg
  2016-08-04 17:28 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Greenberg @ 2016-08-04 15:08 UTC (permalink / raw)
  To: git

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.

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.  In fact, doing a git log on the server doesn't show my latest 
push.  So I need to pull the changes, but I can't because I have pending 
stuff.

What's a good git workflow for this save-upload-remote test cycle?

Thanks,

-- 
Ed Greenberg
Glens Falls, NY USA


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with two copies of same branch diverging
  2016-08-04 15:08 Problem with two copies of same branch diverging Ed Greenberg
@ 2016-08-04 17:28 ` Junio C Hamano
       [not found]   ` <36ecaea6-5f09-25fd-ffa7-61bdaf91414d@greenberg.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2016-08-04 17:28 UTC (permalink / raw)
  To: Ed Greenberg; +Cc: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with two copies of same branch diverging
       [not found]   ` <36ecaea6-5f09-25fd-ffa7-61bdaf91414d@greenberg.org>
@ 2016-08-04 17:57     ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2016-08-04 17:57 UTC (permalink / raw)
  To: Ed Greenberg; +Cc: Git Mailing List

On Thu, Aug 4, 2016 at 10:50 AM, Ed Greenberg <edg@greenberg.org> wrote:
> On 08/04/2016 01:28 PM, Junio C Hamano wrote:
>>
>> ... 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.
>
> If this is the case, why do my fresh clones contain the most recent commit?

Exactly. Why does your "push" not result in "git log" to show the
most recent commit? Once you solve that, "git reset" would do
the right thing, I would think, just like a fresh clone shows the
latest.  The thing is, that I didn't quite find out what your "push"
is doing wrong in your original message.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-04 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 15:08 Problem with two copies of same branch diverging Ed Greenberg
2016-08-04 17:28 ` Junio C Hamano
     [not found]   ` <36ecaea6-5f09-25fd-ffa7-61bdaf91414d@greenberg.org>
2016-08-04 17:57     ` Junio C Hamano

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).