Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
gitflow
Commits
d33e5ea8
Commit
d33e5ea8
authored
Feb 02, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/rebase-subcommand' into develop
parents
4c92a9d3
95bf82c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
12 deletions
+45
-12
git-flow-feature
git-flow-feature
+45
-12
No files found.
git-flow-feature
View file @
d33e5ea8
...
@@ -21,6 +21,7 @@ usage() {
...
@@ -21,6 +21,7 @@ usage() {
echo " git flow feature publish <name>"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature track <name>"
echo " git flow feature diff <name|nameprefix>"
echo " git flow feature diff <name|nameprefix>"
echo " git flow feature rebase [-i] <name|nameprefix>"
}
}
cmd_default() {
cmd_default() {
...
@@ -127,6 +128,21 @@ expand_name_arg_prefix() {
...
@@ -127,6 +128,21 @@ expand_name_arg_prefix() {
BRANCH=$PREFIX$NAME
BRANCH=$PREFIX$NAME
}
}
expand_name_arg_prefix_or_current() {
CURRENT_BRANCH=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
if [ "$NAME" != "" ]; then
expand_name_arg_prefix
elif [ "$CURRENT_BRANCH" != "" ]; then
BRANCH="$CURRENT_BRANCH"
NAME=$(echo "$BRANCH" | sed "s?$PREFIX??g")
else
warn "The current HEAD is no feature branch."
warn "To diff a feature, specify a <name> argument."
usage
exit 1
fi
}
parse_args() {
parse_args() {
# parse options
# parse options
FLAGS "$@" || exit $?
FLAGS "$@" || exit $?
...
@@ -233,9 +249,20 @@ cmd_finish() {
...
@@ -233,9 +249,20 @@ cmd_finish() {
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
fi
fi
# if the user wants to rebase, do that first
if [ $FLAGS_rebase -eq 1 ]; then
if ! git flow feature rebase "$NAME" "$BASE"; then
warn "Finish was aborted due to conflicts during rebase."
warn "Please finish the rebase manually now."
warn "When finished, re-run:"
warn " git flow feature finish '$NAME' '$BASE'"
exit 1
fi
fi
# merge into BASE
# merge into BASE
git checkout $BASE
git checkout $BASE
if [ "$(git rev-list -n2 $BASE..$BRANCH | wc -l)"
= "1"
]; then
if [ "$(git rev-list -n2 $BASE..$BRANCH | wc -l)"
-eq 1
]; then
git merge --ff $BRANCH
git merge --ff $BRANCH
else
else
git merge --no-ff $BRANCH
git merge --no-ff $BRANCH
...
@@ -328,19 +355,25 @@ cmd_track() {
...
@@ -328,19 +355,25 @@ cmd_track() {
cmd_diff() {
cmd_diff() {
parse_args "$@"
parse_args "$@"
CURRENT_BRANCH=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
expand_name_arg_prefix_or_current
if [ "$NAME" != "" ]; then
expand_name_arg_prefix
elif [ "$CURRENT_BRANCH" != "" ]; then
BRANCH="$CURRENT_BRANCH"
else
warn "The current HEAD is no feature branch."
warn "To diff a feature, specify a <name> argument."
usage
exit 1
fi
# TODO: if this feature has been based on a non-develop branch, we really
# TODO: if this feature has been based on a non-develop branch, we really
# should not be comparing to $DEVELOP. How to deal with this?
# should not be comparing to $DEVELOP. How to deal with this?
git diff $DEVELOP_BRANCH..$BRANCH
git diff $DEVELOP_BRANCH..$BRANCH
}
}
cmd_rebase() {
DEFINE_boolean interactive 0 'do an interactive rebase' i
parse_args "$@"
expand_name_arg_prefix_or_current
warn "Will try to rebase '$NAME'..."
gitflow_require_clean_working_tree
gitflow_require_branch "$BRANCH"
git checkout -q "$BRANCH"
OPTS=
if [ $FLAGS_interactive -eq 1 ]; then
OPTS="$OPTS -i"
fi
git rebase $OPTS "$BASE"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment