Tips for placing ~ under resource control
I intend to place my residence directory (~) under resource control (git, in this instance), as I have several establishing documents (. gitconfig,. gitignore,. emacs, and so on) in there I would love to lug across equipments, and also having them in Git would certainly make it wonderful for fetching them.
My major equipment is my MacBook, and also the manner in which OS X is set up, there are several folders I intend to overlook (Documents, Downloads,. ssh). There are additionally folders which are currently making use of Git (. emacs.d).
My idea was to simply add all these directory sites to my.gitignore documents, yet that appears sort of exhausting, and also can possibly bring about some unpredicted effects. My next idea was to occasionally replicate the documents I intend to store right into some folder in residence, after that devote that folder. The trouble with that said will certainly be that I need to bear in mind to relocate them prior to devoting.
Exists a tidy means to do this?
I assume your 2nd suspicion to have non - relevant folder under resource control is excellent.
Simply add 2 shell manuscripts there. One to replicate documents under your control to
~ and also the various other to accumulate documents from
~ and also duplicate it back to the resource - regulated folder and also devote.
I make use of the old
rcs for that.
Look at manpages for
co, and also
rcs. Those websites need to be handy too :
I make use of that for variation regulating my dotfiles as an example :
ci -u .*vimrc
And also if I intend to modify them :
co -l .*vimrc
I advise making a directory site called
RCS in your
~, you can after that conveniently backup that directory site someplace.
What I do (with the very same purposes) is to place my arrangement documents in a subdirectory
~/lib and also have symbolic web links in my residence directory site, as an example,
.emacs -> lib/emacs/dot.emacs. I just maintain arrangement documents that I created clearly under version control ; my residence directory site has plently of instantly - developed dot documents that are not under version control. Hence
~/lib is under version control, and also my residence directory site is not.
I have a manuscript that develops the symbolic web links from the documents under
~/lib. When I create an account on a new equipment, I inhabit it by looking into
~/lib and also running that manuscript.
My experience is with CVS, not git, so it's not 100% transferable. Among the factors I really did not place my residence directory site straight under CVS is that
~/.cvsignore would relate to all my CVS check outs and also not simply my residence directory site ; git does not have this trouble. The disadvantage of that strategy compared to having the residence directory site under version control is that you can not make use of
git status to compare a documents that you've clearly determined to overlook (which would certainly be detailed in the overlook documents, so not presented) and also a documents that you have no point of view concerning (which would certainly be presented with a
Some documents require to be various on various equipments. I placed them in a directory site called
~/Local/SITENAME/lib and also either create symbolic web links for them too or (for documents layouts that sustain it) have an include instruction in the documents under
~/lib. I additionally have a symbolic link
~/Here -> ~/Local/SITENAME. Given that git, unlike CVS, is made to sustain primarily - comparable - yet - not - the same databases, there might be a far better means to take care of equipment - details documents. A few of my dot documents remain in reality not symbolic web links, yet instantly created from web content under
~/lib and also
I have actually
$HOME under git. The first line of my.gitignore documents is
The remainder are patterns to not overlook making use of the
! modifier. This first line suggests the default is to overlook all documents in my residence directory site. Those documents that I intend to version control enter into
.gitignore similar to this :
!/.gitignore !/.profile [...]
A more difficult pattern I have is :
!/.ssh /.ssh/* !/.ssh/config
That is, I just intend to variation
.ssh/config - I do not desire my keys and also various other documents in.ssh to enter into git. The above is just how I attain that.
Edit : Added slashes to start of all courses. This makes the overlook patterns match from the top of the database ($ HOME) as opposed to anywhere. As an example, if
!lib/ was a pattern (do not overlook every little thing in the lib directory site) and also you add a documents
.gitignore, formerly the pattern (
!.gitignore) was matching that. With the leading lower (
!/.gitignore), it will just match
.gitignore in my residence directory site and also not in any kind of subdirectories.
I have not seen an instance where this makes a sensible distinction with my overlook checklist, yet it shows up to me to be extra practically exact.