I would like to have the following setup to work with git: for a given project I would like to have my “origin” repository in a directory of my desktop computer at work ($desktop). Then I would like to be able to access, pull and push from this repository from home or anywhere else ($laptop).
For what I have seen in other questions the process would normally involve creating a bare git repository in my desktop using
$desktop > git init -bare
However my understanding is that this would produce a repository without a working directory. I don’t want this. I want my repository to be project specific, to be located in a given directory in both my desktop and laptop and to keep track only of stuff that I keep in a given directory tree. This is apparently problematic with git and that one should “never” push into a normal repository.
Is there a way of sorting this out?
One possibility is to simply pull from your normal repository on your desktop, but rather than pushing directly to the checked-out branch there, push to some other branch that is only for receiving updates on your laptop, and then merge them separately.
That is:
You can configure
branch.master.push master:from-laptopin your laptop repository so thatgit pushwill push according to that spec by default.