Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

Use git to manage home directory

I'd like to create one single git repo in my Linux $HOME directory. In this repo - obviously - I could add everything under version control, but this wouldn't make any sense. I'd like to only add the files and folders that are relevant to me, like .vimrc, .vim, .bashrc, etc. (probably only hidden files and folders, but maybe not)

I know I could leverage .gitignore to try and achieve such behavior but that would be painful and virtually un-maintainable. Instead, what I'd want to know is if there'd be any way to manually declare files and folders that I would want to manage, and only that.

question from:https://stackoverflow.com/questions/21266948/use-git-to-manage-home-directory

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

.gitignore

# Ignore everything
*

# But not these files...
!*.vimrc
!*.vim
!*.bashrc
!.gitignore

# etc...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...