0

I've just started to learn git and wondering if there is a good way to use git for recovering homebrew and all formulas after the complete reinsallation (instead of installing homebrew and all formulas from scratch on the fresh osx) ... Is it a good idea to create a repo for /usr/local before the reinstallation of os x and then recover it from git? Does anyone have a recipe for this?

Thank you!

6
  • I don't think that is possible. Git will be deleted after reinstall. That will include the repo.
    – Joseph
    Sep 23, 2015 at 4:59
  • but it will be on remote repo... So I'll reinstall homebrew, install git and then somehow recover everything else?
    – drew1kun
    Sep 23, 2015 at 5:05
  • Get a github account. It is free project hosting. It uses git in a GUI or shell. Your choice.
    – Joseph
    Sep 23, 2015 at 5:08
  • Clone the GitHub repo, then copy the files back to the place they must be.
    – Joseph
    Sep 23, 2015 at 5:10
  • yeah, that's what I meant...
    – drew1kun
    Sep 23, 2015 at 5:10

3 Answers 3

1

I would recommend against using GitHub for personal file storage unless you get an enterprise account or find a way to secure your personal data. I learned this the hard way...

But if you're using a Mac, I recommend you look into Mackup. It's a great tool for backing up and can use a local disk or cloud service to backup your files. It's also configurable so you can modify what an app backs up or add your own app config. I highly recommend it.

While this brings you no closer to learning git, there are a number of good tutorials here, here and here that you can check out.

1
  • Well that's an interesting info... I'll mark it as an answer until the the better one appear…
    – drew1kun
    Sep 25, 2015 at 3:17
3

There is an very popular way of doing this using "dotfiles", which are configuration files that you can version on GitHub (or other VCS).

Check out this guide to learn about dotfiles and get started with your own:

Once you've got a "dotfiles" repository set up to backup your configuration, you can add a "Brewfile" which can be used to restore your homebrew config:

Restoring is a matter of checking out your "dotfiles" repo and running a shell script that would kick off:

brew bundle
0

Sign up for GitHub, a free git-based project hosting site. You can clone the repository to your Mac, copy the files to backup, commit, sync, do the operations, install git, clone the repo, copy the files back.

How to backup files using Github

  1. Visit GitHub and sign up for free.
  2. Create a new repository WHILE on GitHub.
  3. Download GitHub for Mac (Not git)
  4. Sign in to GitHub UI and clone the repository.
  5. Locate the repository folder on your Mac.
  6. Copy files to folder.
  7. Use GitHub UI to commit and sync.
3
  • can you be more precise? Do you suggest to create a repository for /usr/local/ (cd /usr/local/ && git init) then add remote and then git add -A && git commit -am "msg" && git push ? Did you actually try to do it (I mean recovering Homebrew formulaes with git)
    – drew1kun
    Sep 23, 2015 at 5:24
  • @Andrew I updated the post
    – Joseph
    Sep 25, 2015 at 19:42
  • @Andrew I run on windows 10
    – Joseph
    Sep 25, 2015 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .