# Update Webservers from a remote repository

3 messages from 2010-09-21 to 2010-09-21. Participants: Matthias Fechner, Ilari Liusvaara.
Thread: https://gitlist.dev/t/25180

## Matthias Fechner, 2010-09-21 09:02

Subject: Update Webservers from a remote repository
Message-ID: <4C9874BB.5060908@fechner.net>
URL: https://gitlist.dev/e/4C9874BB.5060908%40fechner.net

```
Dear list,

I'm new to git but the more I use it I more I like/love it. :)

I have a central --bare git repository which is the master for all web 
servers (I did a git clone http://xxx on each web server).
If I now push changes from my devel station to the central repository I 
would like to have them available on all server with a script.

If I understood everything correctly I execute the following commands on 
each server:
git checkout master (to be sure we are on branch master)
git fetch (to fetch changes from the central repository)
git merge origin (to update the repo to the changes on the central repo)

I use here origin because the remote name for the central server in the 
.git/config file is named origin.

Is that correct or did I missed something?

Thanks,
Matthias

-- 
"Programming today is a race between software engineers striving to 
build bigger and better idiot-proof programs, and the universe trying to 
produce bigger and better idiots. So far, the universe is winning." -- 
Rich Cook

```

## Ilari Liusvaara, 2010-09-21 09:41

Subject: Re: Update Webservers from a remote repository
Message-ID: <20100921094128.GA13619@LK-Perkele-V2.elisa-laajakaista.fi>
URL: https://gitlist.dev/e/20100921094128.GA13619%40LK-Perkele-V2.elisa-laajakaista.fi
In-Reply-To: <4C9874BB.5060908@fechner.net>

```
On Tue, Sep 21, 2010 at 11:02:51AM +0200, Matthias Fechner wrote:
> 
> If I understood everything correctly I execute the following
> commands on each server:
> git checkout master (to be sure we are on branch master)
> git fetch (to fetch changes from the central repository)
> git merge origin (to update the repo to the changes on the central repo)
> 
> Is that correct or did I missed something?

I would do it the following way:

git checkout -f master
git fetch origin
git reset --hard orgin/master


You definitely do not want to run merge non-interactively (conflict risk!)

-Ilari

```

## Matthias Fechner, 2010-09-21 10:52

Subject: Re: Update Webservers from a remote repository
Message-ID: <4C988E84.8020702@fechner.net>
URL: https://gitlist.dev/e/4C988E84.8020702%40fechner.net
In-Reply-To: <20100921094128.GA13619@LK-Perkele-V2.elisa-laajakaista.fi>

```
Am 21.09.10 11:41, schrieb Ilari Liusvaara:
> git checkout -f master
> git fetch origin
> git reset --hard origin/master
>
> You definitely do not want to run merge non-interactively (conflict risk!)

oh good point, thanks a lot.

Bye,
Matthias

-- 
"Programming today is a race between software engineers striving to 
build bigger and better idiot-proof programs, and the universe trying to 
produce bigger and better idiots. So far, the universe is winning." -- 
Rich Cook

```
