Re: [git-users] Working Copy on remote not updating

2015-06-19 Thread Konstantin Khomoutov
On Tue, 16 Jun 2015 04:08:39 -0700 (PDT)
Chad Baloga cbal...@gmail.com wrote:

 I am fairly new to GIT.

Just Git or git.  It's not an acronym ;-)

 When we do a push to the remote repo, the Working Copy on the remote
 does not get updated automatically.

Do you mean the work tree?  In other words, do you mean the copy of
files which are checked out -- the same as in your local repository,
where you actually change the files and then commit the changes?

If yes, as they say, you're doing it wrong.

Forget about your server for a moment and imagine what should actually
happen when you're sitting here hacking on another feature and then
somebody pushes something to your local repository -- what should
happen?  Do you expect all your changes should suddenly disappear --
being replaced with whatever has just been pushed?
I reckon, your answer would be obviously, no! ;-)

But the thing is, Git absolutely does not care whether a repository
is local or on the server -- Git is able to extract history from
a repository and send it to another Git instance, and it is able to
receive history from another Git instance and place it into the
repository -- end of the story.  Everything else is just policy.

To absorb this idea better, just `cd` to another directory on your
local filesystem and do

  git init .
  git clone /path/to/your/local/repo .
  git branch joke
  git push origin joke

...you'll then find a branch named joke in your original repository.
Is that repository remote?  For our new repository we've just created
in the snippet above -- definitely yes; is it remote in your eyes? --
supposedly no.  The same goes for truly remote repositories: they are
deemed to be remote because no one works in them directly, and they
only get updated (via pushes) and queried (via fetches) from clients.

That's how we arrive to this simple fact: work trees are for
programmers.  The only way to update the work tree is to manually tell
Git you want it based on such and such commit.  There's no way to make
Git somehow automatically update the repository's work tree when
that repository receives new history.

Now there's such thing as hooks: Git is able to run programs
(typically scripts) when certain event happens in the repository --
say, the new stuff has just been pushed and some branches updated.
That's exactly what people who still want to use Git as a deployment
tool use: set up a post-update hook to check out stuff from some
dedicated branch and be done with it.  The hook is also able to
compensate for features lacking in Git-as-a-deployment-tool: it does
not store file ownership and access bits / ACLs.

The final point to consider is that for normal repos (those with the
work tree, that is, non-bare) Git by default disallows pushing to the
branch is which is currently checked out.  This is simply to remove the
WTF-factor when your index all of a sudden is out of sync with the
branch it's based on (read the official GIt FAQ for more).

Because of all of the above, deployment is typically done to a bare
repository which has a post-update hook which uses lower-level Git
commands to populate/update work tree *disjoint* from that repository.
Just google for more, and see [1].

Note that you might consider not using Git for deployment at all.
For instance, things like git-ftp work really OK for PHP projects.

1. https://groups.google.com/d/topic/git-users/Lvv7ByIZZ1o/discussion

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Working Copy on remote not updating

2015-06-16 Thread Nelson Efrain A. Cruz
Are you pushing to a bare repo? (It's recommended to only push to a remote
repo) . It's seems you are not, cause you wouldn't have a working directory
at all.

Take a look at https://github.com/blog/1957-git-2-3-has-been-released there
is a new command push-to-deploy but I'm not sure if it's what you are
looking for (and I never used ). And as already said, git it's not a
deployment tool.

El mar, jun 16, 2015 08:08, Chad Baloga cbal...@gmail.com escribió:

 I am fairly new to GIT.  When we do a push to the remote repo, the Working
 Copy on the remote does not get updated automatically.  It shows the
 changes, then we have to either discard the changes or stash them.  If this
 normal or is there a way it can automatically update?  We have 2 branches.
 At first there was only 1 branch.  Thanks!

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Working Copy on remote not updating

2015-06-16 Thread Chad Baloga
I am fairly new to GIT.  When we do a push to the remote repo, the Working 
Copy on the remote does not get updated automatically.  It shows the 
changes, then we have to either discard the changes or stash them.  If this 
normal or is there a way it can automatically update?  We have 2 branches. 
 At first there was only 1 branch.  Thanks!

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Working Copy on remote not updating

2015-06-16 Thread Magnus Therning
On 16 June 2015 at 13:08, Chad Baloga cbal...@gmail.com wrote:
 I am fairly new to GIT.  When we do a push to the remote repo, the Working
 Copy on the remote does not get updated automatically.  It shows the
 changes, then we have to either discard the changes or stash them.  If this
 normal or is there a way it can automatically update?  We have 2 branches.
 At first there was only 1 branch.  Thanks!

I'm not sure I fully understand your question, but git wil *never*
update Working Copy A just because someone pushes changes from Working
Copy B.  The standard answer when someone asks for this is that *git
is not a deployment tool*!

(The reason I'm not sure that I understand the question is the words
then we have to either discard the changes or stash them.  It's
unclear why you would commit and push in one working copy, then fetch
or pull in another just to discard the committed changes...)

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.