Skip to content

Commit e2353bc

Browse files
Lorenzo Pacchiardialshedivat
Lorenzo Pacchiardi
andauthored
Check for local untracked files when deploying (alshedivat#168)
* Check for local untracked files when deploying * Compress test for untracked files to 1 line Co-authored-by: Maruan <alshedivat@users.noreply.github.com> * Add vendor to .gitignore * Add .bundle to .gitignore Co-authored-by: Maruan Al-Shedivat <alshedivat.maruan@gmail.com>
1 parent c4be6f8 commit e2353bc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
_site
2+
.bundle
23
.sass-cache
34
.jekyll-metadata
45
.DS_store
56
.ruby-version
67
.tweet-cache/
78
Gemfile.lock
9+
vendor

bin/deploy

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ if ! git diff-index --quiet HEAD --; then
6767
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
6868
fi
6969

70+
# Check if there are any untracked files
71+
if ! test -z "$(git ls-files --exclude-standard --others)"; then
72+
echo "There are untracked files:"
73+
git ls-files --exclude-standard --others
74+
echo "Please commit those files or stash them before proceeding."
75+
echo "Aborting."
76+
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
77+
fi
78+
7079
# Switch to source branch (creates it if necessary from the current branch)
7180
if [ `git branch | grep $SRC_BRANCH | tr ' ' '\n' | tail -1` ]
7281
then

0 commit comments

Comments
 (0)