Open main menu

CDOT Wiki β

Changes

DPS909 & OSD600 Winter 2017 - Git Walkthrough

1,951 bytes added, 17:14, 11 January 2017
no edit summary
Telling git about the changes to a file's name or path means that it can track changes to the file contents even when it moves (i.e., git will know that <code>LICENSE</code> and <code>LICENSE.txt</code> represent the same thing in the history)
 
===Step 7: fixing common mistakes===
 
A common issue we all run into is committing a change, then realizing we made a mistake or forgot to include a related change. It's fine to just commit again, but what if you made a typo in your commit message or left something out that really should have been included?
 
We can '''amend''' our previous commit instead of making a new one easily. Let's see it in action.
 
First, let's make a change to <code>docs/_includes/callout-warning-color-assistive-technologies.md</code>, which changes '''color''' to '''colour''':
 
{| class="wikitable"
! style="font-weight: bold;" | Before
! style="font-weight: bold;" | After
|-
| <pre>
{% callout warning %}
#### Conveying meaning to assistive technologies
 
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers.
</pre>
| <pre>
{% callout warning %}
#### Conveying meaning to assistive technologies
 
Using colour to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers.</pre>
|}
 
We can stage this change and commit:
 
<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/_includes/callout-warning-color-assistive-technologies.md
 
no changes added to commit (use "git add" and/or "git commit -a")
$ git add docs/_includes/callout-warning-color-assistive-technologies.md
$ git commit -m "Switch color to colour in docs/_includes/callout-warning-color-assistive-technologies.md"
[master 1e9d17d] Switch color to colour in docs/_includes/callout-warning-color-assistive-technologies.md
1 file changed, 5 insertions(+), 5 deletions(-)
rewrite docs/_includes/callout-warning-color-assistive-technologies.md (84%)
</pre>