Skip to content
Merged
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ g.push(g.remote('name'))
# delete remote branch
g.push('origin', 'remote_branch_name', force: true, delete: true)

# push all branches to remote at one time
g.push('origin', all: true)

g.worktree('/tmp/new_worktree').add
g.worktree('/tmp/new_worktree', 'branch1').add
g.worktree('/tmp/new_worktree').remove
Expand Down
4 changes: 3 additions & 1 deletion lib/git/lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,9 @@ def push(remote = nil, branch = nil, opts = nil)
arr_opts = []
arr_opts << '--mirror' if opts[:mirror]
arr_opts << '--delete' if opts[:delete]
arr_opts << '--force' if opts[:force] || opts[:f]
arr_opts << '--force' if opts[:force] || opts[:f]
arr_opts << '--all' if opts[:all] && remote

Array(opts[:push_option]).each { |o| arr_opts << '--push-option' << o } if opts[:push_option]
arr_opts << remote if remote
arr_opts_with_branch = arr_opts.dup
Expand Down
7 changes: 7 additions & 0 deletions tests/units/test_push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ class TestPush < Test::Unit::TestCase
assert_command_line(expected_command_line, git_cmd, git_cmd_args)
end

test 'push with all: true' do
expected_command_line = ['push', '--all', 'origin']
git_cmd = :push
git_cmd_args = ['origin', all: true]
assert_command_line(expected_command_line, git_cmd, git_cmd_args)
end

test 'when push succeeds an error should not be raised' do
in_temp_dir do
Git.init('remote.git', initial_branch: 'master', bare: true)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy