Reputation: 8163
I want two versions of project: stable
and dev
.
It should look like:
/home/me/proj/stable
/home/me/proj/dev
I want do some changes on dev
version and then bring them to stable
.
How I solve the task:
1) Create project in dev
directory
2) git clone dev stable
3) On every change in dev
:
cd /home/me/proj/dev
git add .
git commit -m 'fixes'
cd ../stable
git pull
It works fine, but when I delete some files from dev
, then do pull
, those files are still in stable
. I don't want them there. I want stable
to be full copy of dev
.
Upvotes: 1
Views: 145
Reputation: 70135
Or you might try using GIT with two branches, dev and stable, and by merging branches to keep your two 'versions' in sync. As:
$ mkdir /home/me/proj; cd /home/me/proj
$ git init
$ echo 'README' > README; git add README; git commit -m 'README'
$ git branch stable
$ git checkout -b dev
# do your development
$ git commit <stuff>
# now bring the stuff to <stable>
$ git checkout stable
$ git merge dev
Note: files deleted in dev
will disappear in stable
upon the above merge.
# back to dev for more development
$ git checkout dev
If you need to deploy the stable version somewhere, use
$ cd <parent dir for deploy>
$ git clone /home/me/proj --branch stable
Upvotes: 3
Reputation: 392843
I think you might be looking for
git clean -df .
(although, if the deletions are versioned, then it should be automatic unless there were local changes)
To make sure deletions are tracked, do
git add -A .
instead of just
git commit -am '........'
Upvotes: 1