[AMBER-Developers] TIPS: git pull && git submodule update

From: Hai Nguyen <nhai.qn.gmail.com>
Date: Tue, 7 Nov 2017 00:35:38 -0500

Hi all,

Just FYI a tip: we should always do two commands together:

git pull # update non-submodule codes
git submodule update # update submodule code.

If we missed the 2nd command and try do the shortcut "git commit -a",
the old commits in submodules will be committed (again) and if you push the
code to upstream, the old commits will overwrite the newest submodule
commits. :D

A general tip from Jason with "git commit -a"

-----------

1. I can't use "commit -a" since it commits things I don't understand. This
> requires me to add or commit each file individually, which can involve
> a lot of typing.
>

​The only things that ever get committed in submodules is a pointer to a
particular commit hash in the upstream repository. If this gets messed up,
it's trivial to fix.​ But if you want a recipe to follow that will never
be bad, precede each "git commit -a" with a "git submodule update
--remote". If you do that, then the subsequent "git commit -a" will
actually update the submodules to the latest version:

  alias commit_a="git submodule update --remote; git commit -a"

You'll also avoid this problem if you follow every "git pull" with a "git
submodule update":

  alias pull="git pull && git submodule update --recursive"

or something like that.
-----------

Hai
_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Mon Nov 06 2017 - 22:00:03 PST
Custom Search