But what will you do when your product is installed on testing virtual environment and you see a problem? Fix that on your dev machine in your local repository and then copy files to testing machine, and then, if it works, commit ?
Not very efficient! You need the immediate feedback, and you get that only if you modify files directly there - on testing environment!
But if you start doing that and make changes in 3-4 places, and then copy it back into your local repository and commit, again probably you are in trouble! Why? Because you are human being and human beings tend to forget things.
So here is an idea - not proven by the production usage but works on test repositories. The idea is based on how git interprets changes. It identifies every file in working directory by path. And it doesn’t delete if there is no file which is in the latest commit. And it does nice merge if there is no conflict.
Ok, closer to the body:
You have your production repository A:
.git
--Folder1
If after the installation there is the same folders tree. It is very important trees you’ll be changing in have to be the same in both repositories!
%Install Dir%
You can do this on your dev machine:
$cd //remote-host/Install Dir/
$git init
You don’t want to track everything just JavaScript files
$git add *.js
$git commit -m ‘first commit’
Then you fix the problem. After changing file1.js, file2.js ….
$git commit -a -m ‘problem fixed’
Nothing magic so far, just simple orphaned git repository not connected to your product at all.
Here is the fun! You go to your main repository:
$cd /c/main
$git remote add remote-host //remote-host/Install Dir/
$git merge remote-host
$git commit -a -m ‘all fixed files in the main repository!’‘
git doesn’t bother about the same files in both repositories, it takes only changes!
Done :)
P.S. Ups, don’t forget about your Acceptance Tests suite! Git doesn’t run it for you! ;)
Add a comment