Similar to:
I'm trying to figure out the workflow steps to accomplish the following:
W:\DEV\proj1
git init W:\DEV\proj1
cd W:\DEV\proj1
git add *
git commit -m"1st home"
P:\DEV\roam1
git clone . P:\DEV\roam1
// new file f1.txt
git add *
git commit -m"1st portable"
git ???
-- sync f1.txt > "home"?// new file f2.txt
git add *
git commit -m"2nd home"
git ???
-- sync f2.txt > "portable"Part A) I think I understand how to clone and sync to a "centralized hub", i.e. github or putting a bare repo on a usb stick and cloning from it whenever I'm at a new location, but I'd rather not have to clone from the portable repo every time I want to get work done in a new place. Also, in the case where I just want to look at the file on a computer that doesn't have git installed.
Part B) Another applicable scenario is that I want to use git to basically backup a directory to an external harddrive (which pushing to a bare repo would normally be fine) but I want to access the files on the harddrive on another computer without git installed.
but I'd rather not have to clone from the portable repo every time I want to get work done.
You won't have to, except to initialize your repo in a new location (in which case, you would clone the bare repo of your usb stick on your local environment)
Every time you want to get work done, you would:
git pull
(or git pull --rebase) in order to get potential changes from usb back to localYou need some kind of "centralized/portable" repo to pull from/push to.
not wanting the "centralized hub" to be a bare repo is that, let's say I go another computer without git and I want to just show someone a file
I would still recommend a bare repo on the usb stick, but I would add a post-receive hook on that bare repo, in order to update a separate working tree (still on the usb stick)
See "Want to setup a hook that copies committed files to a particular folder" as an example of such a hook.
That way, I always have, on my "centralized and portable" git repo hosting environment (ie the usb key!):