Search code examples
gitvimpathogen

Git Update Changes not from Sub Module - ~/.vim - Pathogen


I was following the guide from here John Anderson Vim Setup to help setup vim. he steps through adding the various submodules to git in the format

git submodule add http://github.com/tpope/vim-fugitive.git bundle/fugitive

since completing his guide I have made further changes. Getting ahead of myself I am on ubuntu my path is ~/.vim and I used the exact {autoload,bundle} setup as described in the guide.

I want to include the changes I added in my ~/.vimrc and the ohther bundles I have installed into my github so I can clone it and go on any other PC.

Really struggling to figure out how to get the changes in git. For example in my ~/.vim/bundle/ directory it has two new folders delimitMate and colorschemes. However when I do git push it returns everything as up to date.

What am I missing?


Solution

  • Those are submodules, I figure. What you need to do, is:

    # To add new modules
    git add .gitmodules
    git commit -m "Add new bundles"
    # To add changes in vimrc
    git add vimrc
    git commit -m "Update my vimrc"
    # To upload to Github
    git push origin
    

    On another PC, after cloning/pulling the Github repo, you need to:

    git submodule init
    git submodule update
    

    To pull new changes to submodules you can later:

    git submodule foreach git pull origin master
    # NOTE: no trailing slash!
    git add bundles/fugitive
    git add bundles/etc
    git commit -m "Update bundles"
    git push
    

    You can reduce the many adds by the following command:

    git ls-files -m bundles | xargs git add