Skip to content

Commit

Permalink
Allow --force for push commands
Browse files Browse the repository at this point in the history
  • Loading branch information
extsoft committed Jul 15, 2018
1 parent 2cb36d8 commit 4e8729b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Creates a new branch based on `master`. If there are some uncommitted changes, t
Downloads new updates for a local branch.

### push
Upload current local branch to a remote one. If the remote branch is absent, it will be created. Pushing to remote `master` aren't allowed.
Upload current local branch to a remote one using `force` push. If the remote branch is absent, it will be created. Pushing to remote `master` isn't allowed.

### rebase
Reapplies commits on top of the latest `origin/master`.
Expand Down
2 changes: 1 addition & 1 deletion src/main/git-elegant-push
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ default() {
box "No pushes to 'master' branch. Read more on $__site"
exit 81
fi
boxtee git push -u origin $BRANCH:$BRANCH
boxtee git push --set-upstream --force origin $BRANCH:$BRANCH
}
6 changes: 3 additions & 3 deletions src/test/git-elegant-push.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ teardown() {

@test "'push': by default name of remote branch is equal to local branch" {
fake-pass git branch *feature1
fake-pass git "push -u origin feature1:feature1"
fake-pass git "push --set-upstream --force origin feature1:feature1"
check git-elegant push
[ "$status" -eq 0 ]
[ "${lines[1]}" = "== git push -u origin feature1:feature1 ==" ]
[ "${lines[1]}" = "== git push --set-upstream --force origin feature1:feature1 ==" ]
}

@test "'push': raise error #81 if current local branch is master" {
fake-pass git branch *master
fake-pass git "push -u origin master:master"
fake-pass git "push --set-upstream --force origin master:master"
check git-elegant push
[ "$status" -eq 81 ]
[ "${lines[1]}" = "== No pushes to 'master' branch. Read more on http://elegant-git.extsoft.pro ==" ]
Expand Down

0 comments on commit 4e8729b

Please sign in to comment.