Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
chromedriver.log
*.class
#Test123
#test1234
# Package Files #
*.jar
*.war
Expand Down
48 changes: 48 additions & 0 deletions script/merge_upstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Update source code from main repository

# Pop any stashed changes
unstash() {
if [[ "$stash" =~ "No local changes to save" ]]; then
echo "* No stashed changes, not popping"
else
echo "* Popping stash..."
git stash pop
fi
}

# Pop any stashed changes and exit
rollback() {
echo
echo "Something went wrong, rolling back"
unstash
exit $1
}

# Stash any local change"
echo "* Stash any local changes"
stash=$(git stash)

remote_upstream="upstream"
remote_upstream_master_branch="master"

upstream_remote_exists=$(git branch -r --no-color | egrep "$remote_upstream/$remote_upstream_master_branch\$")

if [ -n "$upstream_remote_exists" ] && [ ! "$upstream_remote_exists" == '' ]; then
echo "* Upstream remote branch exists ....."
else
echo "* Adding upstream remote branch"
git remote add upstream https://github.com/interview-com-ua/website.git
fi

echo "* Fetching from upstream "
git fetch upstream || rollback $?
echo "* Checkout local master "
git checkout master
echo "* Merge local master and upstream/master"
git merge upstream/master || rollback $?
echo "* Push changes into remote origin/master"
git push origin

unstash
read -rp "* Done. Press any key to continue..." key
48 changes: 48 additions & 0 deletions script/merge_upstream_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
# Update source code from main repository

# Pop any stashed changes
unstash() {
if [ "$stash" != "No local changes to save" ]; then
echo "* No stashed changes, not popping"
else
echo "* Popping stash..."
git stash pop
fi
}

# Pop any stashed changes and exit
rollback() {
echo
echo "Something went wrong, rolling back"
unstash
exit $1
}

# Stash any local change"
echo "* Stash any local changes"
stash=$(git stash)

remote_upstream="upstream"
remote_upstream_master_branch="master"

upstream_remote_exists=$(git branch -r --no-color | egrep "$remote_upstream/$remote_upstream_master_branch\$")

if [ -n "$upstream_remote_exists" ] && [ ! "$upstream_remote_exists" == '' ]; then
echo "* Upstream remote branch exists ....."
else
echo "* Adding upstream remote branch"
git remote add upstream https://github.com/interview-com-ua/website.git
fi

echo "* Fetching from upstream "
git fetch upstream || rollback $?
echo "* Checkout local master "
git checkout master
echo "* Merge local master and upstream/master"
git merge upstream/master || rollback $?
echo "* Push changes into remote origin/master"
#git push origin

unstash
read -rp "* Done. Press any key to continue..." key