In this gist we are about to push changes from one working directory to another working directory without bare repository
Lets name our directories one_working , second_working.
Lets create the one_working directory
mkdir one_working
cd one_working
git init
cat > index.html
Hello World
Press Ctrl + C
git status
git add .
git commit -m "initial commit"
Lets create the second working directory and add some configurations
mkdir second_working
cd second_working
git init
git config receive.denyCurrentBranch ignore
cd .git/hooks
cat > post-update
git update-server-info
unset GIT_DIR GIT_WORK_TREE
cd ../ && git reset --hard
Press Ctrl + C
chmod +x post-update
Now move to the one working directory and add remote path and then push changes to second working directory
cd one_working
git remote add second_working /home/YOURUSERNAME/path/second_working
git remote -v
git push second_working master
Lets suppose there has been modifications in second working directory, what is the easiest way to compare both repositories ?
git remote update
git diff master second_working/master
Feel free to correct me in anyways.
By the way it's not recommended way to work on different directories, one must use the central repository which would be the bare to pull and push changes.
Regards, Huzaifa Arain