I found this neat way to migrate dotfiles between computers.

It works, but I don't really understand how. I can do everything he mentions in the article, but what I can't figure out is how I fetch and update after making a change on another device. I usually just do a git fetch --all + git reset --hard origin/branch. This isn't doing the trick, so I'm updating by deleting the .cfg folder and all the tracked dotfiles, then re-applying the installation procedures. Is that the correct approach?

  • to be clear, are you running config fetch --all + config reset --hard origin/branch ? – sourcejedi Aug 24 '17 at 20:00
  • No, that gives me error messages. Those commands are what I normally use when updating a local repo from a remote, but in this case that does not update the dotfiles in my ~/ directory. – 20salmon Aug 24 '17 at 20:15
  • 1
    At a guess, the problem is you normally rely on the initial git clone to set up "remote-tracking branches for each branch in the cloned repository". But --bare is documented as skipping that, so I'm a bit confused by the blog! Looking at the HN thread, maybe it would be better with git clone --no-checkout --separate-git-dir=~/.cfg <git-repo-url> ~ – sourcejedi Aug 24 '17 at 20:20
  • 1
    If you read the comments below the blog, people already noticed the instructions are broken because of this: config push can't possibly work as suggested. If you look a bit further, people end up working around the instructions, getting it to work after a manual remote add <name> <url> (presumably config remote ... would work). – sourcejedi Aug 24 '17 at 20:27
  • 1
    As an aside I would encourage you to graduate from constant use of git reset --hard. It's a bit dangerous IMO, silently throwing away any uncommitted changes. I think git reset --keep will preserve any uncommitted changes, aborting if there's a conflict. – sourcejedi Aug 24 '17 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.