You are not logged in.

#1 2015-04-28 19:04:07

smnpl
Member
From: Germany
Registered: 2015-01-07
Posts: 54

Problems managing dotfiles with git; Especially submodules

Hi all,

at the moment I'm trying to sync my dotfiles between my computers and after doing some searching online I found, that git might be a convenient way to do so.
Though, I now have a bit of a problem understanding what I'm trying to do. Hopefully I can explain...

I've got these files:
~/dotfiles
    .git
    .vim
    .vimrc
    .zpreztorc
Everything is in the git repository.

Now, .zpreztorc is a submodule cloned from github. These files need customization:
~/dotfiles/.zpreztorc/runcoms
    zpreztorc
    zshrc
    ...

The problem and question is, since .zpreztorc is a submodule, how would I be able to commit and push my customizations to the listed files to my repository in order to pull them from another computer?a

I feel I should leave out the submodules from my personal dotfile repository, but am not 100% sure and if I'm right, what's the correct / best approach?

Hope my issue is clear,
best regards!

E: Sorry for obviously wrong category.

Last edited by smnpl (2015-04-28 19:13:15)


The road to wisdom? - Well, it's plain and simple to express: Err and err and err again but less and less and less. - Piet Hein -

Offline

#2 2015-04-28 19:11:43

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Problems managing dotfiles with git; Especially submodules

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-04-28 19:27:15

progandy
Member
Registered: 2012-05-17
Posts: 5,203

Re: Problems managing dotfiles with git; Especially submodules

Maybe you should use git subtree instead of submodules. Then you can track all changes in one repository. Otherwise, you'll have to create one remote repository clone for each submodule.
Edit: I think the files in runcoms are only example files, am I right? Then just copy (not symlink) them in the right place outside of the submodule. Now you can keep the upstream submodule since you don't have any changes in that directory.

Last edited by progandy (2015-04-28 19:33:11)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2015-04-28 20:01:06

smnpl
Member
From: Germany
Registered: 2015-01-07
Posts: 54

Re: Problems managing dotfiles with git; Especially submodules

I'll have a look into subtree, maybe that helps (tomorrow though, since it's getting late in germany).
Not sure if you get your suggestion right. But if I copy out the files from runcom, then yes, I can keep the upstream submodule, but as well the changes I make in those files won't have a syncing mechanism available, to bring those to my other computers... (?)

regards


The road to wisdom? - Well, it's plain and simple to express: Err and err and err again but less and less and less. - Piet Hein -

Offline

#5 2015-04-28 20:10:53

progandy
Member
Registered: 2012-05-17
Posts: 5,203

Re: Problems managing dotfiles with git; Especially submodules

smnpl wrote:

Not sure if you get your suggestion right. But if I copy out the files from runcom, then yes, I can keep the upstream submodule, but as well the changes I make in those files won't have a syncing mechanism available, to bring those to my other computers... (?)

Then put them in a new directory below ~/dotfiles if you want to keep your submodule.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2015-04-29 08:34:05

TheSpiritof69
Member
Registered: 2015-03-14
Posts: 7

Re: Problems managing dotfiles with git; Especially submodules

I've had the exact same issue recently.

I am using stow with a dotfiles-Repository in a similar fashion. I ended up using git subtrees since submodules don't allow for customizations to be tracked and pushed to a custom repository.

I've set up my dotfiles repo like this:

~/
--dotfiles/ (my git repo is here)
  --awesome/
    --.config/
      --awesome/ (here starts a subtree, cloned from awesome-copycats)
        --rc.lua (my customizations)
          --lain/ (submodule of awesome-copycats, no changes by me needed, it's a dependency of awesome-copycats)
          --foo/

I wanted to set it up via submodules at first as well, after referring to http://blogs.atlassian.com/2013/05/alte … t-subtree/ I recognized a combination of subtree and submodule (for the dependencies) as the proper solution.

Last edited by TheSpiritof69 (2015-04-29 08:34:40)

Offline

#7 2015-04-29 18:37:28

smnpl
Member
From: Germany
Registered: 2015-01-07
Posts: 54

Re: Problems managing dotfiles with git; Especially submodules

Thanks for your help so far. After some more searching today, I found that someone asked the exact same question on the github page of prezto (which is the one causing me trouble):
https://github.com/sorin-ionescu/prezto/issues/840

After reading that, and another very good blogpost:
http://www.anishathalye.com/2014/08/03/ … -dotfiles/
I decided to do as those suggest.

I set it up like I explained above with git submodules. Only difference is, that I forked prezto on my github and added the submodule from there. After that I added the original prezto repo as remote to mine, called upstream as suggested on the github help page for forking. Now I can commit my local prezto changes to my fork. And, when I pull an update from prezto (my upstream) I'll probably have to resolve the conflicts with my customizations on merge... I'll see how that will work out.
https://help.github.com/articles/fork-a-repo/


The road to wisdom? - Well, it's plain and simple to express: Err and err and err again but less and less and less. - Piet Hein -

Offline

Board footer

Powered by FluxBB