Open main menu

CDOT Wiki β

Changes

DPS909 & OSD600 Winter 2017 - Git Walkthrough

3,180 bytes added, 13:03, 11 January 2017
no edit summary
</pre>
If we inspect our repo's history again, we'll see all of the commits we just made:
 
<pre>
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
 
commit 3679b53441a4df21b06875ed0bf4e286ecfd13a7
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 11:37:00 2017 -0500
 
Add js/ dir
 
commit 5decfb341f6d9780053a4416d8adcf09a7b5b349
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 11:34:00 2017 -0500
 
Add *.json files
 
commit de3af0b5e829047495043779d2d9d65a85e611f9
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 11:31:47 2017 -0500
 
Added some more files
 
commit 4ffa53b8304a4f64e998217a1f1e07ccb300ede5
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 11:30:16 2017 -0500
 
Added more files
 
commit 03c95518ce08f59e850409a2d82bacad110151a1
Author: David Humphrey (:humph) david.humphrey@senecacollege.ca <david.humphrey@senecacollege.ca>
Date: Wed Jan 11 11:07:09 2017 -0500
 
Added README file
</pre>
 
===Step 5: updating an existing tracked file===
 
So far we've only added new files. Once a file is being tracked by git, we can also make changes to it, and record that change. The process is very similar to adding a new file: both methods involve staging a new snapshot of our repo's files and committing it.
 
Let's make a change to <code>docs/index.html</code> and record it in our git history.
 
First, open <code>docs/index.html</code> in your favourite editor and let's change the wording in the beginning of the file slightly. We'll change <code>Bootstrap is the most popular...</code> to <code>Bootstrap is an amazing...</code>:
 
{| class="wikitable"
! style="font-weight: bold;" | Before
! style="font-weight: bold;" | After
|-
| <pre>
---
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>
</pre>
| <pre>
---
layout: home
---
 
<main class="bd-masthead" id="content">
<div class="container">
<span class="bd-booticon outline">B</span>
<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>
</pre>
|}
 
Save the file and let's check our status:
 
<pre>
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
 
modified: docs/index.html
 
no changes added to commit (use "git add" and/or "git commit -a")
</pre>
 
 
 
===Step 6: moving and removing files===
 
We want to record every change we make to our files. This includes adding new files, but
* Client Server (SVN) and Distributed (Git)