3 # We don't want (for now) to work with .git in nonstandard locations.
4 #readonly REPOCONFIGDIR="$(git rev-parse --git-dir)"
6 readonly REPODIR
="$(git rev-parse --show-toplevel)"
9 # GITCONFIG/master branch in our main working repo (origin)
10 # should hold the config prepared for saving and restoring
11 # (i.e., no junk commits).
12 if [[ ! -e .git
/refs
/heads
/GITCONFIG
/master
]]; then
15 echo $
"Don't know where to pull from:"
16 echo $
"your main repo has no GITCONFIG/master"
17 echo $
"and you haven't given a remote name as an arg!"
21 git fetch
-v "$1" GITCONFIG
/master
22 # We expect this to be done manually otherwise.
23 git branch GITCONFIG
/master
"$1"/GITCONFIG
/master
29 if [[ -d .git
]]; then
30 # Already initialized.
31 # Please, add and commit interesting files beforehand manually,
32 # otherwise merge will fail.
41 # Like git stash --include-untracked:
43 git commit
--allow-empty -m 'Automatically saving your local modifications to the config (for "stashing").'
44 echo $
"Afterwards, do not forget to: " 'git reset --mixed HEAD^'
46 # Pulling from GITCONFIG/master in origin:
47 # (We have set up such behavior in our gitgitconfig-init.)
48 git pull
--rebase -v --no-edit
49 # Our local modifications remain ontop of the previously saved config.
51 # Like git stash pop (which doesn't work for new untracked files):
52 git
reset --mixed HEAD^
54 # We'll see how merging works out.