blob: 927b6f841e483809c16add7115cabfab16c4acff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/sh
# This script performs a checkout with same arguments as `git checkout`
# but makes sure that submodules are initialized in exactly the way
# described in the branch/tag.
# This is useful to avoid having to cleanup the tree after checkout
# to prevent files interfering with Eclispe and updating submodules
# manually.
#
# NOTE: This does not prevent other untracked files from intefering
# with Eclipse.
#
# WARNING: THIS WILL DISCARD ALL LOCAL MODIFICATIONS TO YOUR SUBMODULES.
# MAKE SURE TO COMMIT/PUSH OR SAVE THEM BEFORE YOU EXECUTE THIS SCRIPT.
set -e
git submodule foreach 'rm -rf $toplevel/$path'
git checkout "$@"
git submodule sync
git submodule update --init
|