I have a quite specific need, and I can’t get it to work, hence I turn to you, Git and Stack Overflow friends.
I have a server my live site runs on. I wish to update the site using Git. To avoid live testing, I wish to set up a testing environment on the same server, accessible through a subdomain, as if the development folder is a branch of master.
As far as I know, you can’t have branches in different folders, which makes sense. Instead, I cloned the live repository into another folder. From my home computer, I push to a feature branch of the development repository, where I merge it with the “remote” master branch and then push the merges to the live server.
Unfortunately, when I try to push my development master to live master, git log
does mention the new commits, but the files remain the same. This question appears relevant, but no answer solved my problem.
What I do (in chronological order)
~/www $ git init
~/www $ git touch file.txt
(and fill it)~/www $ git add .
~/www $ git commit -m "Initial commit"
~/dev $ git clone ~/www .
- Make some changes to
~/dev/file.txt
~/dev $ git add .
~/dev $ git commit -m "Dev commit"
~/dev $ git push
When inspecting ~/www/file.txt
, nothing has changed :(
A git log
command in ~/www
(the original repository) does show the commit:
commit 677fed22f18d2a98c9b03fc4256c2ef78bd68e8d
Author: Tim Severien <tim********@gmail.com>
Date: Sat Feb 14 16:36:38 2015 +0100
Dev commit
commit 7dd9b40dd29a63ba8ea7d647b4afd575f2376659
Author: Tim Severien <tim********@gmail.com>
Date: Sat Feb 14 16:35:39 2015 +0100
Initial commit
- Why doesn’t my live repository change?
- Do you have better ideas for this kind of workflow?