Skip to content

Commit

Permalink
Make full reset of WORK_BRANCH when accept-work
Browse files Browse the repository at this point in the history
`--force` is used to throw away local changes.
`-B` allows to reset branch if it already exists.

So, this change allows accepting a new work in case if previous was not
accepted (for instance, due to conflicts) by allowing recreation of
WORK_BRANCH.
  • Loading branch information
extsoft committed Jul 30, 2019
1 parent 0dc4bd3 commit 5003bb1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ usage: git elegant accept-work <remote-branch>
A sequence of original `git` commands:
```bash
git fetch --all --tags
git checkout -b __eg <remote-branch-name>
git checkout --force -B __eg <remote-branch-name>
git rebase origin/master
git checkout master
git merge --ff-only __eg
Expand Down
2 changes: 1 addition & 1 deletion libexec/git-elegant-accept-work
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default() {
_error-if-empty "${WORK}" "Please give a name of remote branch (like 'origin/123')."
local WORK_BRANCH="__eg"
boxtee git fetch --all --tags
boxtee git checkout -b ${WORK_BRANCH} ${WORK}
boxtee git checkout --force -B ${WORK_BRANCH} ${WORK}
boxtee git rebase ${RMASTER}
# @todo #137 Alternative flows of `accept-work`
# If this command is executed with `${WORK_BRANCH}` and
Expand Down
2 changes: 1 addition & 1 deletion tests/git-elegant-accept-work.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ teardown() {

@test "'accept-work': a work is accepted successfully for given remote branch" {
fake-pass git "fetch --all --tags"
fake-pass git "checkout -b __eg origin/work"
fake-pass git "checkout --force -B __eg origin/work"
fake-pass git "rebase origin/master"
fake-pass git "checkout master"
fake-pass git "merge --ff-only __eg"
Expand Down

0 comments on commit 5003bb1

Please sign in to comment.