Skip to content

Instantly share code, notes, and snippets.

@rogaldh
Last active May 19, 2016 15:49
Show Gist options
  • Save rogaldh/33152686f6c8fec6882ccbff180fef7e to your computer and use it in GitHub Desktop.
Save rogaldh/33152686f6c8fec6882ccbff180fef7e to your computer and use it in GitHub Desktop.
separate `.git` at one dir with indie `*.gitignore`

separate .git at one dir with indie *.gitignore

1.init .git twice

$ git init --separate-git-dir=src.git
$ rm .git
$ git init --separate-git-dir=prd.git
$ rm .git

2.prepare aliases

$ touch deploy.sh
$ nano deploy.sh

3.paste that to deploy.sh

#!/bin/sh
alias prd='git --git-dir=prd.git'
alias src='git --git-dir=src.git'

4.run deploy.sh

$ source deploy.sh

5.specify local individual .gitignores

$ src config --add core.excludesfile src.gitignore
$ prd config --add core.excludesfile prd.gitignore

6.profit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment