snipt

Ctrl+h for KB shortcuts

Text only

Force push branch

1
2
3
4
5
git push -f <remote> <branch>

e.g. git push -f origin master <-- Don't use master 

Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream.
https://snipt.net/embed/501243ea466193f664fac3097323f58c/
/raw/501243ea466193f664fac3097323f58c/
501243ea466193f664fac3097323f58c
text
Text only
5
2024-05-08T06:29:42
True
False
False
/api/public/snipt/113/
force-push-branch
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git push -f &lt;remote&gt; &lt;branch&gt; </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>e.g. git push -f origin master &lt;-- Don&#39;t use master </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>Leaving off &lt;remote&gt; and &lt;branch&gt; will force push all local branches that have set --set-upstream. </span></pre></div> </td></tr></table>
git
1
2
3
4
5
6
7
8
--- 
+++ 
@@ -1,2 +1,5 @@
 git push -f <remote> <branch>
-(e.g. git push -f origin master). Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream.+
+e.g. git push -f origin master <-- Don't use master 
+
+Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream.
1
2
3
4
5
--- 
+++ 
@@ -0,0 +1,2 @@
+git push -f <remote> <branch>
+(e.g. git push -f origin master). Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream.