... | @@ -1779,7 +1779,7 @@ You probably noticed that most of the commits are: |
... | @@ -1779,7 +1779,7 @@ You probably noticed that most of the commits are: |
|
- Short
|
|
- Short
|
|
- Written in the imperative verb tense
|
|
- Written in the imperative verb tense
|
|
- Under 80 characters
|
|
- Under 80 characters
|
|
- Do not end in punctuation
|
|
- Missing end punctuation
|
|
|
|
|
|
Let us examine one of the commits.
|
|
Let us examine one of the commits.
|
|
|
|
|
... | @@ -1796,7 +1796,7 @@ Let us examine one of the commits. |
... | @@ -1796,7 +1796,7 @@ Let us examine one of the commits. |
|
```
|
|
```
|
|
|
|
|
|
The first three lines are commit metadata:
|
|
The first three lines are commit metadata:
|
|
- Commit Hash (id)
|
|
- Commit Hash (ID)
|
|
- Author
|
|
- Author
|
|
- Date & Time
|
|
- Date & Time
|
|
|
|
|
... | @@ -1809,12 +1809,12 @@ The remaining lines (i.e., the commit message) describe a group of changes. |
... | @@ -1809,12 +1809,12 @@ The remaining lines (i.e., the commit message) describe a group of changes. |
|
description.
|
|
description.
|
|
|
|
|
|
As a general rule all lines should not exceed 80 characters. This avoids
|
|
As a general rule all lines should not exceed 80 characters. This avoids
|
|
horizontal scrolling.
|
|
horizontal scrolling when viewing two files side-by-side.
|
|
|
|
|
|
|
|
|
|
### Suggested Reading
|
|
### Suggested Reading
|
|
|
|
|
|
If you search Google with the query *"Writing good git commit messages"* you
|
|
If you search Google with the query *"Writing good git commit messages"*... you
|
|
will find more than a few resources. However, I am partial to
|
|
will find more than a few resources. However, I am partial to
|
|
<https://github.com/erlang/otp/wiki/Writing-good-commit-messages>. The page is
|
|
<https://github.com/erlang/otp/wiki/Writing-good-commit-messages>. The page is
|
|
short and concise.
|
|
short and concise.
|
... | @@ -2146,7 +2146,7 @@ code style, alongside the normal updates. This lead to four (4) new branches: |
... | @@ -2146,7 +2146,7 @@ code style, alongside the normal updates. This lead to four (4) new branches: |
|
- f19-prep
|
|
- f19-prep
|
|
|
|
|
|
The `f19-prep` branch was the *normal update* branch. The former three branches
|
|
The `f19-prep` branch was the *normal update* branch. The former three branches
|
|
were used for code cleanup based on code linting and style analysis tools.
|
|
were used for code cleanup based on code linting and other analysis tools.
|
|
|
|
|
|
- style-cleanup-python
|
|
- style-cleanup-python
|
|
- [pylint](https://www.pylint.org/)
|
|
- [pylint](https://www.pylint.org/)
|
... | @@ -2172,7 +2172,7 @@ This Presentation was written in Vim... |
... | @@ -2172,7 +2172,7 @@ This Presentation was written in Vim... |
|
- using markdown...
|
|
- using markdown...
|
|
- using the [CS department GitLab server](https://git-community.cs.odu.edu)...
|
|
- using the [CS department GitLab server](https://git-community.cs.odu.edu)...
|
|
- in a Gitlab Wiki...
|
|
- in a Gitlab Wiki...
|
|
- which uses git to track history.
|
|
- uses git to track edit history.
|
|
|
|
|
|
|
|
|
|
### Where Did I Stop?
|
|
### Where Did I Stop?
|
... | @@ -2194,8 +2194,8 @@ immediate ancestor. |
... | @@ -2194,8 +2194,8 @@ immediate ancestor. |
|
|
|
|
|
![git diff example](git-diff-example.PNG)
|
|
![git diff example](git-diff-example.PNG)
|
|
|
|
|
|
Of course most tools (e.g., vimdiff) yield much more *human readable* diffs. I
|
|
Of course most tools (e.g., `vimdiff`) yield much more *human readable* diffs.
|
|
would use vimdiff with...
|
|
I would use `vimdiff` with...
|
|
|
|
|
|
```
|
|
```
|
|
git difftool HEAD^
|
|
git difftool HEAD^
|
... | @@ -2221,6 +2221,7 @@ There are two main goals for this discussion: |
... | @@ -2221,6 +2221,7 @@ There are two main goals for this discussion: |
|
1. Motivate the use of Git (i.e., show git's value).
|
|
1. Motivate the use of Git (i.e., show git's value).
|
|
2. Demonstrate how to set up a basic git repo.
|
|
2. Demonstrate how to set up a basic git repo.
|
|
|
|
|
|
|
|
|
|
## Basic Commands
|
|
## Basic Commands
|
|
|
|
|
|
Before we can discuss *merge* and *rebase*, we must focus on the basic
|
|
Before we can discuss *merge* and *rebase*, we must focus on the basic
|
... | @@ -2265,14 +2266,14 @@ equivalent git commands within the client. |
... | @@ -2265,14 +2266,14 @@ equivalent git commands within the client. |
|
|
|
|
|
### Opening the Terminal
|
|
### Opening the Terminal
|
|
|
|
|
|
If you are on Windows open:
|
|
If you are on Windows, open:
|
|
|
|
|
|
- [Cygwin](https://www.cygwin.com/)
|
|
- [Cygwin](https://www.cygwin.com/)
|
|
- [WSL Bash](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
|
|
- [WSL Bash](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
|
|
- [Git Bash](https://www.atlassian.com/git/tutorials/git-bash)
|
|
- [Git Bash](https://www.atlassian.com/git/tutorials/git-bash)
|
|
- [git for Windows](https://gitforwindows.org/)
|
|
- [git for Windows](https://gitforwindows.org/)
|
|
|
|
|
|
If you are on macOS or Linux open your terminal.
|
|
If you are on macOS or Linux, open your terminal.
|
|
|
|
|
|
> If you need to install git, <https://git-scm.com/downloads> provides a set of
|
|
> If you need to install git, <https://git-scm.com/downloads> provides a set of
|
|
> instructions for Windows, macOS and Linux.
|
|
> instructions for Windows, macOS and Linux.
|
... | @@ -2287,8 +2288,8 @@ Since git repos need code... we will use one of my Python lectures from CS 417 |
... | @@ -2287,8 +2288,8 @@ Since git repos need code... we will use one of my Python lectures from CS 417 |
|
(Computational Methods). Open [Python non-linear solver discussion](https://www.cs.odu.edu/~tkennedy/cs417/s20/Public/solverDiscussion/)
|
|
(Computational Methods). Open [Python non-linear solver discussion](https://www.cs.odu.edu/~tkennedy/cs417/s20/Public/solverDiscussion/)
|
|
in your web browser.
|
|
in your web browser.
|
|
|
|
|
|
1. In your terminal create a new folder. You may use any name you choose (provided
|
|
1. In your terminal create a new folder. You may use any name you choose
|
|
there are not spaces in the directory name).
|
|
(provided there are no spaces in the directory name).
|
|
|
|
|
|
```sh
|
|
```sh
|
|
mkdir git-workshop
|
|
mkdir git-workshop
|
... | @@ -2318,7 +2319,7 @@ in your web browser. |
... | @@ -2318,7 +2319,7 @@ in your web browser. |
|
git config user.name "tkennedy@cs.odu.edu"
|
|
git config user.name "tkennedy@cs.odu.edu"
|
|
```
|
|
```
|
|
|
|
|
|
*Note:* I prefer to set my name and email for each repos. If you want to set
|
|
*Note:* I prefer to set my name and email for each repo. If you want to set
|
|
your name and email globally (i.e., for all repos) add `--global` after
|
|
your name and email globally (i.e., for all repos) add `--global` after
|
|
`git config`.
|
|
`git config`.
|
|
|
|
|
... | @@ -2518,7 +2519,7 @@ Date: Mon Mar 2 15:17:38 2020 -0500 |
... | @@ -2518,7 +2519,7 @@ Date: Mon Mar 2 15:17:38 2020 -0500 |
|
|
|
|
|
Now we are ready to start adding some actual code. Both `.gitignore`
|
|
Now we are ready to start adding some actual code. Both `.gitignore`
|
|
and `README.md` files should always be created proactively during initial repo
|
|
and `README.md` files should always be created proactively during initial repo
|
|
creation. These files must never be an after thought.
|
|
creation. These files must never be an afterthought.
|
|
|
|
|
|
1. Create new Python file named `newtons_method.py`.
|
|
1. Create new Python file named `newtons_method.py`.
|
|
2. Copy the example code from the `newtons_method_1.py` listing from
|
|
2. Copy the example code from the `newtons_method_1.py` listing from
|
... | | ... | |