Open main menu

CDOT Wiki β

Changes

DPS909 & OSD600 Winter 2017 - Git Walkthrough

2,946 bytes added, 16:45, 11 January 2017
Step 5: updating an existing tracked file
* the change to this file starts at line 5 in the original, and we have 7 lines of context
* the actual line that changed is shown with a delete (<code>-</code>) followed by an addition (<code>+</code>)
 
Let's commit this change. Just like we did when we first added this file, we'll <code>git add</code> then <code>git commit</code>:
 
<pre>
$ git add docs/index.html
$ git commit -m "Update language in docs/index.html"
[master e26ed85] Update language in docs/index.html
1 file changed, 1 insertion(+), 1 deletion(-)
</pre>
 
We can review this commit by using <code>git show [commit sha]</code>. If we don't specify a particular commit sha to show, git will show us the last commit (aka, <code>HEAD</code>):
 
<pre>
commit e26ed85fd69e11c8b4325617bdba3fad9746f99e
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 15:41:01 2017 -0500
 
Update language in docs/index.html
 
diff --git a/docs/index.html b/docs/index.html
index b762da7..f43edfa 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,7 +5,7 @@ layout: home
<main class="bd-masthead" id="content">
<div class="container">
<span class="bd-booticon outline">B</span>
- <p class="lead">Bootstrap is the most popular HTML, CSS, and JS framework in the world for building responsive, mobile-first projects on the web.</p>
+ <p class="lead">Bootstrap is an amazing HTML, CSS, and JS framework in the world for building responsive, mobile-first projects on the web.</p>
<p class="lead">
<a href="{{ site.baseurl }}/getting-started/download/" class="btn btn-lg" onclick="ga('send', 'event', 'Jumbotron actions', 'Download', 'Download {{ site.current_version }}');">Download Bootstrap</a>
</p>
</pre>
 
You can also ask git to show you changes in the log by adding the <code>-p</code> flag (i.e., "show patch"):
 
<pre>
$ git log -p
commit e26ed85fd69e11c8b4325617bdba3fad9746f99e
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 15:41:01 2017 -0500
 
Update language in docs/index.html
 
diff --git a/docs/index.html b/docs/index.html
index b762da7..f43edfa 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,7 +5,7 @@ layout: home
<main class="bd-masthead" id="content">
<div class="container">
<span class="bd-booticon outline">B</span>
- <p class="lead">Bootstrap is the most popular HTML, CSS, and JS framework in the world for building responsive, mobile-first projects on the web.</p>
+ <p class="lead">Bootstrap is an amazing HTML, CSS, and JS framework in the world for building responsive, mobile-first projects on the web.</p>
<p class="lead">
<a href="{{ site.baseurl }}/getting-started/download/" class="btn btn-lg" onclick="ga('send', 'event', 'Jumbotron actions', 'Download', 'Download {{ site.current_version }}');">Download Bootstrap</a>
</p>
 
commit e189bada7f9e77e8717cada46fa7cd05d6103172
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 11:39:35 2017 -0500
 
Add everything else
...
</pre>
===Step 6: moving and removing files===