Author: buildbot
Date: Thu Nov 29 15:09:18 2012
New Revision: 840005

Log:
Staging update by buildbot for isis

Modified:
    websites/staging/isis/trunk/cgi-bin/   (props changed)
    websites/staging/isis/trunk/content/   (props changed)
    websites/staging/isis/trunk/content/contributors/using-git.html

Propchange: websites/staging/isis/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Nov 29 15:09:18 2012
@@ -1 +1 @@
-1415150
+1415202

Propchange: websites/staging/isis/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Nov 29 15:09:18 2012
@@ -1 +1 @@
-1415150
+1415202

Modified: websites/staging/isis/trunk/content/contributors/using-git.html
==============================================================================
--- websites/staging/isis/trunk/content/contributors/using-git.html (original)
+++ websites/staging/isis/trunk/content/contributors/using-git.html Thu Nov 29 
15:09:18 2012
@@ -379,7 +379,8 @@ git rebase --continue
 <p>Once the rebase is finished, you'll see the branch <em>branchname</em> as a 
direct descendent of <code>master</code> (use <code>gitk --all</code> to 
confirm).  You will still be on the <em>branchname</em>.  To catch up 
<code>master</code>, use:</p>
 
 <pre>
-git merge master --ff-only
+git checkout master
+git merge <i>branchname</i> --ff-only
 </pre>
 
 <p>The <code>--ff-only</code> ensures that the merge is a fast-forward; ie all 
commits will have only a single parent, and no conflicts.</p>
@@ -387,7 +388,6 @@ git merge master --ff-only
 <p>At this point you can delete the branch:</p>
 
 <pre>
-git checkout master
 git branch -d <i>branchname</i>
 </pre>
 
@@ -450,6 +450,46 @@ git stash pop
 <li><a 
href="http://www.kernel.org/pub/software/scm/git/docs/gitignore.html";>man 
page</a></li>
 </ul>
 
+<h2>More advanced use cases</h2>
+
+<h3>If accidentally push to remote</h3>
+
+<p>Suppose you committed to <code>master</code>, and then pushed the change, 
and then decided that you didn't intend to do that:</p>
+
+<pre>
+C1  -  C2  -  C3  -  C4  -  C5  -  C6  -  C7
+                                          ^
+                                          master
+                                          ^
+                                          origin/master
+</pre>
+
+<p>To go back to an earlier commit, first we wind back the local 
<code>master</code>:</p>
+
+<pre>
+git reset --hard C5
+</pre>
+
+<p>where <code>C5</code> is the long sha-id for that commit.</p>
+
+<p>This gets us to:</p>
+
+<pre>
+C1  -  C2  -  C3  -  C4  -  C5  -  C6  -  C7
+                            ^
+                            master
+                                          ^
+                                          origin/master
+</pre>
+
+<p>Then, do a force push:</p>
+
+<pre>
+git push origin master --force
+</pre>
+
+<p>If this doesn't work, it may be that the remote repo has disabled this 
feature.  There are other hacks to get around this, see for example <a 
href="http://stackoverflow.com/questions/1377845/git-reset-hard-and-a-remote-repository";>here</a>.</p>
+
 
 
       </div>


Reply via email to