[git-users] Re: Setting up a remote repo when the local is already in course

2011-02-12 Thread Thomas Ferris Nicolaisen
It depends a bit on what you already have on your live site.

I think you should make a distinction between working on the source code 
using git repositories, and doing actual deployment of your site.

I think I would do something like this. First you want to set up a 
reproducable/scriptable routine for deploying your site the way it is today:

1) Copy your live server's files to a local directory called "site" or 
something
2) Initialize a git repo in this directory (cd site; git init)
3) Important: Take a backup of your live server's contents that you can 
restore if you want to go back to the old way.
4) Clear out the live server (or move the old contents away or something)
5) Publish the site git repo to your server, if possible use a tool for this 
like Capistrano .

If you don't want to, or can't use Capistrano, you can use git 
archiveand
 upload the archive to the server and unpack it manually.

Once you've done this, you can start working on your local site repo and 
merge in the other changes you've been working on locally. And then repeat 
the deployment routine. Post back here when you get to this step and need 
more help.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Setting up a remote repo when the local is already in course

2011-02-12 Thread Jeenu


On Feb 12, 6:40 am, Daniel Trezub  wrote:
> Hi,
>
> I've been working with git in my local repo for some months already (i.e.
> there is already a bunch of commits and some branches), and I'd like to use
> git to integrate with my online server (use git pull, push, clone, fetch,
> etc).
>
> How should I start? Is there a way to do this without messing with my local
> history and without the risk to kill my live site?
>
> I've tried setting a remote repo (git add origin ssh:user@server) and doing
> a 'git pull' while on the branch i'd like to sync with the online server,
> but it created another branch. Is it ok? Or should I use git fetch?
>
> After that, what should I do to upload my changes without risking to kill my
> live site? I have a branch named 'master' that is supposed to be my release
> branch.
>
> I think I am doing ok with my local repo and git, but the remote part is
> still a mystery to me.
>
> Thanks for your help, pals!

The first step is to take backup of your local repo. It's always good
to have your release/master branch to have a linear history. If not
already, you could make it so by cherry-pick/rebase Git commands.
Having done that, you could add the server to which you want to push
to, as a remote branch, using Git remote command:

git remote add origin 

Here you're calling the remote server as origin by convention, but you
can put anything sensible there.  can take various
forms, depending on your access method. For example, it could be

g...@server.com:username/repo.git
ssh://usern...@server.com/path/to/repo.git
git://server.com/path/to/repo.git
http://server.com/path/to/repo.git

For first method, you would most likely have a ssh public key which
you should add to the SSH agent; for ssh methods, you'd be prompted
for a password.

If everything went fine, you should do

git push origin master

(which tells Git to push local master branch to the remote named
origin) and you're done. You could launch gitk to see that your
branches master and origin/master are at the same commit.

HTH

--
Jeenu

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Setting up a remote repo when the local is already in course

2011-02-13 Thread Jeenu


On Feb 14, 5:15 am, Daniel Trezub  wrote:
> It's always good to have your release/master branch to have a linear
>
> > history.
>
> Why? Does it make things easier when pushing to the remote repo?

It's got nothing to do with pushing. It's just that your graph will
look tidy and it'll more readable as well. Git will push your commit
graph to the server however it looks.

--
Jeenu

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Setting up a remote repo when the local is already in course

2011-02-14 Thread Jeenu


On Feb 15, 4:16 am, Daniel Trezub  wrote:
> Ok, thanks. So, even if my remote repo is a brand-new one and my local repo
> is ages old with a lots of history, after the push the remote repo will have
> all my history?

If all your history is reachable from the branch head that you're
pushing to the remote, then yes, I think all of your commit graph will
be replicated. However, AFAIK, it doesn't imply that pushing master
will also push all the branches before it. You'd have all the commits,
but the remote wouldn't have other branches. Branches, as we know it,
are mere references or "soft links" to commits. The remote wouldn't
host a branch unless you push that branch itself.


For example, if you've a local branch named "topic", just 2 commits
behind "master", and you push master to the remote, any fresh clone
from the remote repo wouldn't have "topic" in it. To have a remote
branch "topic", you must push "topic" explicitly. Pushing "topic"
again wouldn't cause any data transfer as the commit is already
present in remote repo (as it's reachable from master when it was
pushed).

--
Jeenu

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Re: Setting up a remote repo when the local is already in course

2011-02-13 Thread Daniel Trezub
Hi, guys.

Some other questions:

It depends a bit on what you already have on your live site.
>

Why? My live site is supposed to be the same version from my master branch
in my local repo.

4) Clear out the live server (or move the old contents away or something)
>

But this way I'll have a downtime in my site :(

It's always good to have your release/master branch to have a linear
> history.
>

Why? Does it make things easier when pushing to the remote repo?

I've found this method, with uses only git and warrant no downtime:

http://joemaller.com/990/a-web-focused-git-workflow/

Now, my question is about the remote way of live with git: when I
merge/rebase to a remote/origin/master branch, git only updates my local
copy of this branch, right? I should use "git push" to send the changes to
the server or it'll do it automatically?

Thanks a lot!

Daniel Trezub

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Re: Setting up a remote repo when the local is already in course

2011-02-14 Thread Daniel Trezub
Ok, thanks. So, even if my remote repo is a brand-new one and my local repo
is ages old with a lots of history, after the push the remote repo will have
all my history?

=
Daniel Trezub
http://www.gameblogs.com.br


On 13 February 2011 23:46, Jeenu  wrote:

>
>
> On Feb 14, 5:15 am, Daniel Trezub  wrote:
> > It's always good to have your release/master branch to have a linear
> >
> > > history.
> >
> > Why? Does it make things easier when pushing to the remote repo?
>
> It's got nothing to do with pushing. It's just that your graph will
> look tidy and it'll more readable as well. Git will push your commit
> graph to the server however it looks.
>
> --
> Jeenu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To post to this group, send email to git-users@googlegroups.com.
> To unsubscribe from this group, send email to
> git-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/git-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.