git-gui: Allow forced push into remote repository
Some workflows allow the user to forcefully update a remote branch, such as in a "proposed updates" (aka "pu") branch where the branch is rewound and rebuilt on a daily basis against the current master branch. In such a case the "--force" or leading + must be used to make git-push execute anyway, even though it may be discarding one or more commits on the remote side. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Oct 2, 2007 at 12:52 UTC
1952aa1d5735ccbedd832620e43db3e03fc77088
1 file changed
+10
lib/transport.tcl
+10
@@ -32,6 +32,7 @@ proc push_to {remote} {
32
33
proc start_push_anywhere_action {w} {
34
global push_urltype push_remote push_url push_thin push_tags
35
+ global push_force
36
37
set r_url {}
38
switch -- $push_urltype {
@@ -45,6 +46,9 @@ proc start_push_anywhere_action {w} {
46
if {$push_thin} {
47
lappend cmd --thin
48
}
49
+ if {$push_force} {
50
+ lappend cmd --force
51
+ }
52
if {$push_tags} {
53
lappend cmd --tags
54
}
@@ -76,6 +80,7 @@ trace add variable push_remote write \
80
proc do_push_anywhere {} {
81
global all_remotes current_branch
82
global push_urltype push_remote push_url push_thin push_tags
83
+ global push_force
84
85
set w .push_setup
86
toplevel $w
@@ -151,6 +156,10 @@ proc do_push_anywhere {} {
156
pack $w.dest -anchor nw -fill x -pady 5 -padx 5
157
158
labelframe $w.options -text [mc "Transfer Options"]
159
+ checkbutton $w.options.force \
160
+ -text [mc "Force overwrite existing branch (may discard changes)"] \
161
+ -variable push_force
162
+ grid $w.options.force -columnspan 2 -sticky w
163
checkbutton $w.options.thin \
164
-text [mc "Use thin pack (for slow network connections)"] \
165
-variable push_thin
@@ -163,6 +172,7 @@ proc do_push_anywhere {} {
172
pack $w.options -anchor nw -fill x -pady 5 -padx 5
173
174
set push_url {}
175
+ set push_force 0
176
set push_thin 0
177
set push_tags 0
178