paperlined.org
apps > git
document updated 12 years ago, on May 14, 2012
What if you wanted to version-control just ONE script, among a directory of other scripts? Could each individual script have its own separate git repository, even though they're in the same directory?

Yes, by setting --git-dir and --work-tree to the appropriate settings.

The attached Bash alias (function ogit()) does this for you.



'ogit' is a wrapper for 'git', call it almost exactly like you would call 'git'. The only thing that has been added is the command "ogit use", which designates the ogit repo that you will use for all future 'ogit' calls: