GithubHelp home page GithubHelp logo

featheredtoast / ghar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from philips/ghar

1.0 3.0 0.0 78 KB

ghar: home as repositories

Home Page: http://ifup.org/2010/10/31/ghar-managing-your-home-in-git/

License: GNU General Public License v2.0

Python 98.24% Shell 1.76%

ghar's Introduction

ghar (ghar: home as repositories)

ghar can help you manage your $HOME in git using a collection of git repos seperated by topic or privacy. For example if you work on a variety of machines and want to share your .emacs on github but not your .ssh then ghar is for you.

Brandon Philips [email protected]

INSTALL

ghar aims to be self contained to make it easy to use on machines where you may not have root. The clone of ghar you make below contains the ghar tool and will be the directory in which you clone all of your dotfile repos.

$ git clone https://github.com/philips/ghar.git
$ export PATH=$PATH:`pwd`/ghar/bin/ # You may wish to make this permanent

If you'd like bash tab completion, either move the included ghar-bash-completion.sh into /etc/bash_completion.d/ (requires root), or source the file directly:

$ . `pwd`/ghar/ghar-bash-completion.sh

Getting Started

Now, lets create a devel repo which will contain your .vimrc config file (or any other dotfile you choose). And then have ghar install it.

"ghar repos" are git repositories contained under the root ghar directory. For example if you cloned ghar in a directory called $HOME/tools in the INSTALL step above you will want to cd into $HOME/tools/ghar now to create your first ghar repo called devel:

$ cd ghar	# cd into the clone of ghar you made in the INSTALL step
$ ls
bin COPYING README
$ mkdir devel
$ cd devel
$ git init
$ mv ~/.vimrc .
$ git add .vimrc
$ git commit -m "vimrc: initial commit"
$ ghar install
  devel
    installed	/home/philips/.vimrc
$ ghar install --status
  devel
   ok	/home/philips/.vimrc

Adding External Repos

Adding an external repo is easy. ghar will do a git clone of the external repo into the proper directory and then install the symlinks with two commands:

$ ghar add git://github.com/robbyrussell/oh-my-zsh.git oh-my-zsh
$ ghar install
  oh-my-zsh
   installed	/home/philips/.oh-my-zsh

Upgrading a machine

To upgrade a machine to the latest version of all of the repos do the following:

$ ghar pull		# pull in all repos
$ ghar install	# install any new files

DONE! Enjoy the latest version of your configs.

Ignoring Files

ghar looks for a .gharignore file in each ghar repo it installs. This file lists, one per line, fnmatch-style patterns (e.g. README.*, *.txt, etc.) to ignore when creating symlinks.

Example .gharignore:

LICENSE
README.*
.gitmodules

Thanks

These two chaps helped me on the original bash implementation. However, our original plan of attack ended up being too unwieldy as it used the --git-dir directive to do the magic instead of symlinks.

  • Graham Forest
  • Gavin McQuillan

Contributors

  • Jeff Wong
  • Matthew Batema
  • Torne Wuff
  • Jacob Kaplan-Moss
  • aff0
  • Charles R. Hogg III

Notes about Windows support

Creating symlinks under Windows requires Administrator rights. This means that you will have to run ghar as Administrator / with elevated privileges (Windows Vista and higher).

ghar's People

Contributors

philips avatar onnodb avatar mattwillsher avatar tylerdave avatar mlb- avatar tornewuff avatar slippycheeze avatar jacobian avatar featheredtoast avatar

Stargazers

Jonathan Barratt avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.