Keeping local libs up-to-date

In my ~/.bashrc I have export SKETCHBOOK_DIR=/home/samjnaa/bn/kbdio/ and under /home/samjnaa/bn/kbdio/ there is hardware/keyboardio which contains all the actual stuff:

[samjnaa desktop:~/bn/kbdio/hardware/keyboardio] (master *=) ls
avr  build-tools  COPYING  Makefile  README.md  toolchain  x86

My bother is that no matter how much I git pull in the above directory, the * indicated changes not staged doesn’t seem to disappear:

[samjnaa desktop:~/bn/kbdio/hardware/keyboardio] (master *=) git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   avr/libraries/Kaleidoscope (new commits)
        modified:   avr/libraries/Kaleidoscope-Hardware-Virtual (new commits)
        modified:   avr/libraries/Model01-Firmware (new commits)

no changes added to commit (use "git add" and/or "git commit -a")

I am using the following script under avr/libraries to pull all the subrepos:

#! /bin/sh
echo "*** pulling current dir first"
git pull
for x in *
do
    if [ -d $x ] ; then
        echo "*** entering $x"
        cd $x
        git checkout master
        git pull
        cd ..
    fi
done

Perhaps I am doing it in a totally convoluted way? What is the easy recommended way of staying updated to the remote and how can I get rid of that “changes not staged” message?

The easiest would be to run make maintainer-update-submodules (which is very similar to your shell script above) to keep the submodules up-to-date. To get rid of the warning too, switch to a local branch, and run make blindly-commit-updates, which will run maintainer-update-submodules and commit the results, thus getting rid of the message.

The downside of this is that you won’t be able to follow updates in the bundle itself… so perhaps a better way would be to create a local branch, and use the following little script:

#! /bin/sh
git fetch origin
git reset --hard origin/master
make maintainer-update-submodules
git commit -a -m "Blindly pull all plugins up to current"

This first fetches upstream changes (but doesn’t update the working tree), then resets the current tree to the new upstream, then updates all the submodules, and commits the results back. Thus, its always up to date, no annoying status messages either. But you can’t have local modifications either.

I think it’s rare to have local changes to the bundle repo, so this should be fine. Let me know if it isn’t, and we’ll figure something out.

Hmm seems quite convoluted?!

If you say I can confidently ignore the “changes not staged” generated in the parent repo even after recursively pulling all the changes in the sub-repos, then I’d be glad to do so.

I’ve been ignoring them confidently for the past two years. Unless you’re a vendor, or otherwise interested in tagging bundle releases, you can safely ignore the “changes not staged” statuses.