Sync changes #
Checking for updates #
Project updates #
To get the latest models-for-missing-data code, navigate to your project directory using a terminal, and run git pull
.
Submodule updates / individual submodules #
cd <submodule path> # e.g., model-api
git fetch
git checkout gh-submodule
git pull origin gh-submodule
Submodule updates / all submodules simultaneously #
First, be sure to do any necessary housekeeping (remove, stash, or commit changes). To get the latest updates for each of the submodules, run:
git submodule update --recursive --remote
If you encounter an error, it’s likely you’ve made changes locally that are not yet saved (staged and committed using git add
and git commit
). Git won’t replace changes in uncommitted files with changes on the remote by default. This is desirable behavior. Try committing your changes locally before syncing with the remote.
Pushing local changes to a submodule to its remote #
First, cd
into the submodule directory. We’re going to do all of our Git work within the context of the submodule. If you’ve got uncommitted changes, do any necessary housekeeping:
Note
If you’re seeing files after running git status
that you don’t want to commit to the version history, open the “.gitignore” file and add a new entry for the file you want to ignore. You can open “.gitignore” with any text editor, including RStudio.
git status
git fetch
git checkout gh-submodule
git add .
git commit -m "<some descriptive message about your changes>"
git push origin gh-submodule
As always, please ensure you’re not staging / committing unwanted files (e.g., binary files).
Troubleshooting #
If, on an attempt to pull from the remote submodule, you got fatal: Not possible to fast-forward, aborting
, try:
git merge origin/<submodule>