Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 373003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:15:56+00:00 2026-05-12T14:15:56+00:00

In production, I maintain two sites – beta and release. Each points to a

  • 0

In production, I maintain two sites – beta and release. Each points to a different directory via a soft link (e.g.)

beta_public_html -> /home/scott/myapp/trunk/public
public_html      -> /home/scott/myapp/branches/1.2.3/public

I’m a longtime svn user, moving to git. I’m used to deploying via svn update and changing the soft link on a new branch, things are pretty simple.

Now I’m moving to git. I still need to have the two soft links (it’s a Rails app using Passenger), though now I want them to point to two different git branches (“beta” and “release”, say). And I want to be able to update them via git push (or git pull).

Question Part 1: I’m not sure the best way to do this.

The way I had started to do it was to just deploy to two different remotes, e.g.

git push ssh://scott@x.com/home/scott/myapp-beta beta
git push ssh://scott@x.com/home/scott/myapp-release release

But this doesn’t work because push doesn’t update the working tree by default.

So I go into the remote directories and run git reset –hard the first time, and it pulls the working tree. But I push again and I can’t get the new push to show up – it just stays at the initial one.

(BTW, note that I can’t seem to push to “myapp-beta.git” – that fails, I have to push to the directory name. I am worried that this is part of the problem, but I don’t know what I did wrong here.)

So, if the answer to Question 1 is that my method is fine, Question Part 2: what’s wrong with what I’m actually doing? If there are hooks I should be using, can someone point me to them?

(An answer to Question 1 that says “run these seven manual steps” will not be a terribly useful answer, seeing as svn checkout + ln -s are two steps.)

Thanks. I want to get back to writing code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:15:56+00:00Added an answer on May 12, 2026 at 2:15 pm

    The article Git push is worse than worsless has an interesting discussion about a similar issue.

    One of its solution and conclusion involves:

    • a bare repository on the production server
    • a cloned repository with a hook to pull what has been pushed into the bare one

    So in your case,

    • one bare repo on which you can push beta and release branches
    • two cloned repo ‘beta’ and ‘release’ with a hook to pull their respective branches from the bare repo.

    In short: one step: git push. No more link to manage (since the directory no longer represent a branch in Git, unlike SVN)


    Regarding the hook part, a post-receive hook in the bare repo could be all what you need

    See Git Tip: Auto update working tree via post-receive hook

    $ cd bare
    $ chmod +x .git/hooks/post-receive
    
    with a post-receive hook like
    
    #!/bin/sh
    cd ../../beta
    env -i git reset --hard
    cd ../../release
    env -i git reset --hard
    

    Note:

    the post-receive hook starts out with the GIT_DIR environment variable set to the repo/.git folder, so no matter what path you ‘cd‘ into it will always try to run any following git commands there.
    Fixing this is simply a matter of unsetting the GIT_DIR.

    ‘env -i’ does just that: it ignores the inherited environment completely and uses only the supplied variables and values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 282k
  • Answers 282k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First things first: don't declare the method static. It's a… May 13, 2026 at 4:01 pm
  • Editorial Team
    Editorial Team added an answer I believe the common practice is to do what you're… May 13, 2026 at 4:01 pm
  • Editorial Team
    Editorial Team added an answer Do you want to "replace" the old script? That is… May 13, 2026 at 4:01 pm

Related Questions

In production, I maintain two sites - beta and release. Each points to a
We have a fairly robust system using NHibernate, we're in the middle of migrating
I'd like to store a set of key/value pairs in the application settings of
I am making changes to an existing database while developing new software. There is
I'm working on a SaaS project that will have each customer having an instance

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.