forked from nvie/gitflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-flow-reset
51 lines (46 loc) · 1.77 KB
/
git-flow-reset
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# ITM Gitflow script package -- A collection of Git extensions to provide
# high-level repository operations for Vincent Driessen's branching model.
#
# A blog post by Vincent Driessen presenting this model is found at:
# http://nvie.com/posts/a-successful-git-branching-model/
#
# Feel free to contribute to this project at:
# https://github.com/fspreng/ITM_gitflow
#
# Copyright (c) 2012-2015 Fabian Spreng. All rights reserved.
#
init() {
require_git_repo
require_gitflow_initialized
gitflow_load_settings
BRANCH=$(git_do branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
}
usage() {
# echo "usage: $GITFLOW_COMMAND reset <commit_message>"
echo "usage: $GITFLOW_COMMAND reset <arguments>"
echo " see the git reset man page for further information"
}
cmd_default() {
# record changes to the local and the remote repository
echo "Executing Git command 'git reset $@'"
git_do reset "$@" >/dev/null 2>&1 || \
die "Could not reset HEAD of local repository $BRANCH."
echo "Executing Git command 'git fetch -q $ORIGIN $BRANCH:refs/remotes/$ORIGIN/$BRANCH'"
git_do fetch -q "$ORIGIN" "$BRANCH":refs/remotes/"$ORIGIN"/"$BRANCH" >/dev/null 2>&1 || \
# echo "Executing Git command 'git remote prune origin'"
# git_do remote prune origin >/dev/null 2>&1 && die "Could not fetch $BRANCH from $ORIGIN."
die "Could not fetch $BRANCH from $ORIGIN. ('git remote prune origin' could be useful)"
echo "Executing Git command 'git push origin $BRANCH'"
git_do push origin "$BRANCH" >/dev/null 2>&1 || \
die "Could not push to $BRANCH from $ORIGIN."
echo
echo "Summary of actions:"
# echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- HEAD of the local and the remote branch '$BRANCH' has been reset"
echo
}
cmd_help() {
usage
exit 0
}