summaryrefslogtreecommitdiffstats
path: root/gitcore-tutorial.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-09 19:54:04 -0700
committerJunio C Hamano <gitster@pobox.com>2019-07-09 19:54:04 -0700
commitc9f11c2b3a739e3e249b9e7711bf1ed76ef3c6db (patch)
tree06ddfc72dff8e370e395a3acc692c8ab48147227 /gitcore-tutorial.html
parentd0a9940c76b71c9df840a098a423d3400779d83c (diff)
downloadgit-htmldocs-c9f11c2b3a739e3e249b9e7711bf1ed76ef3c6db.tar.gz
Autogenerated HTML docs for v2.22.0-428-g6d5b2
Diffstat (limited to 'gitcore-tutorial.html')
-rw-r--r--gitcore-tutorial.html21
1 files changed, 10 insertions, 11 deletions
diff --git a/gitcore-tutorial.html b/gitcore-tutorial.html
index 3f48df6fd..c9a4a8d3c 100644
--- a/gitcore-tutorial.html
+++ b/gitcore-tutorial.html
@@ -1465,7 +1465,7 @@ used earlier, and create a branch in it. You do that by simply just
saying that you want to check out a new branch:</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout -b mybranch</code></pre>
+<pre><code>$ git switch -c mybranch</code></pre>
</div></div>
<div class="paragraph"><p>will create a new branch based at the current <code>HEAD</code> position, and switch
to it.</p></div>
@@ -1481,7 +1481,7 @@ just telling <em>git checkout</em> what the base of the checkout would be.
In other words, if you have an earlier tag or branch, you&#8217;d just do</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout -b mybranch earlier-commit</code></pre>
+<pre><code>$ git switch -c mybranch earlier-commit</code></pre>
</div></div>
<div class="paragraph"><p>and it would create the new branch <code>mybranch</code> at the earlier commit,
and check out the state at that time.</p></div>
@@ -1491,7 +1491,7 @@ and check out the state at that time.</p></div>
<div class="paragraph"><p>You can always just jump back to your original <code>master</code> branch by doing</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout master</code></pre>
+<pre><code>$ git switch master</code></pre>
</div></div>
<div class="paragraph"><p>(or any other branch-name, for that matter) and if you forget which
branch you happen to be on, a simple</p></div>
@@ -1515,7 +1515,7 @@ checking it out and switching to it. If so, just use the command</p></div>
</div></div>
<div class="paragraph"><p>which will simply <em>create</em> the branch, but will not do anything further.
You can then later&#8201;&#8212;&#8201;once you decide that you want to actually develop
-on that branch&#8201;&#8212;&#8201;switch to that branch with a regular <em>git checkout</em>
+on that branch&#8201;&#8212;&#8201;switch to that branch with a regular <em>git switch</em>
with the branchname as the argument.</p></div>
</div>
</div>
@@ -1529,7 +1529,7 @@ being the same as the original <code>master</code> branch, let&#8217;s make sure
that branch, and do some work there.</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout mybranch
+<pre><code>$ git switch mybranch
$ echo "Work, work, work" &gt;&gt;hello
$ git commit -m "Some work." -i hello</code></pre>
</div></div>
@@ -1544,7 +1544,7 @@ does some work in the original branch, and simulate that by going back
to the master branch, and editing the same file differently there:</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout master</code></pre>
+<pre><code>$ git switch master</code></pre>
</div></div>
<div class="paragraph"><p>Here, take a moment to look at the contents of <code>hello</code>, and notice how they
don&#8217;t contain the work we just did in <code>mybranch</code>&#8201;&#8212;&#8201;because that work
@@ -1672,7 +1672,7 @@ to the <code>master</code> branch. Let&#8217;s go back to <code>mybranch</code>,
<em>git merge</em> to get the "upstream changes" back to your branch.</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout mybranch
+<pre><code>$ git switch mybranch
$ git merge -m "Merge upstream changes." master</code></pre>
</div></div>
<div class="paragraph"><p>This outputs something like this (the actual commit object names
@@ -1872,9 +1872,8 @@ and bring ourselves back to the pre-merge state:</p></div>
work." commit.</p></div>
<div class="listingblock">
<div class="content">
-<pre><code>$ git checkout mybranch
-$ git reset --hard master^2
-$ git checkout master
+<pre><code>$ git switch -C mybranch master^2
+$ git switch master
$ git reset --hard master^</code></pre>
</div></div>
<div class="paragraph"><p>After rewinding, the commit structure should look like this:</p></div>
@@ -2459,7 +2458,7 @@ to follow, not easier.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
- 2018-01-26 15:11:04 PST
+ 2019-07-09 19:51:04 PDT
</div>
</div>
</body>