git commit -m "Comment"
command.
Git Overview
Git is a software that enables tracking changes to a coding project over time. Git projects can be thought of as having 3 working parts:
A Working Directory - a working area where you work, make changes, and organize files.
A Staging Area - place to list the changes you are making in the Working directory.
A Repository - where git stores changes in a permanent versions of the project.
Using a Git Project
To start a Git Project, use the BASH terminal and navigate to where you intend to create a Git repositort. Type
git init
into the terminal to create the repository.- As the project develops,
git status
can return the current state of changes to the project. - To add files to the git tracking, use
git add filename
. This will add files to the scope of the project. Multiple files can be added at once by seperating filenames by a space. - Example:
git add scene-3.txt scene-5.txt
Alternatively, you can add all of the files in a directory using
git add .
. The . acts as a placeholder for all files.- To check on changes to the files, use
git diff filename
for each file return a summary of what has changed since the last commit. - A commit is the last step of a Git Workflow. To commit, type
git commit -m "Insert a description for the commit here"
. The description should be 50 characters or less.

Checking the log
Git history can be checked to see a log of commits. This is done by typing git log
into
the terminal. The resulting text shows:
- a unique code identifier for the commit.
- The author of the commit
- The date and time of the commit
- The commit message.
How to Backtrack in Git
In using Git, it may be necessary to backtrack a file that you have made a change to. To do this, use the following code command:
Another useful backtracking is required when you realize you staged a file but you actually don't want to include it in your commit.
Finally, the git head can be reset to any previous commit using a command.
git checkout HEAD {filename}
This will restore the file in the working directory to the last commit completed against it, disgarding all recent changes.
git reset HEAD {filename}
This script will unstage file changes in the staging area for a select file. The file in the working directory won't be affected by this change.
git reset commit_SHA
The commit_SHA is the first 7 digits of the long SHA code obtained from a previous git commit. These
can be seen using the command Git log
.

Additional Git Functions to know
In addition to the functions listed above, there are a few additional key git commands that are worth learning.
- Git Stash - stash enables a user to temporarily store changes to a file to return to a clean commit
and make changes, recommit, and then once again load the in progress edits. This is done with the
command
git stash
. This stores current code. Users can then switch to an alternate branch to make and commit changes. To return to the stashed code, type the syntaxgit stash pop
. - Git Branch -
git branch <brandName> allows a user to create new branches of our git code during its development.
- Git Log
git log
returns a log of all git commits, their comments, and the SHA/hash of the commits - Git commit --amend - commit --amend enables a user to replace the last commit with the changes from
the current file, as well as with a new comment if desired. If no new comment is desired, the full command
should read
git commit --amend --no-edit
- Git aliasing - aliasing enables replacing the full text of some git commands with chosen shortcuts.
Example:git config --global alias.co "checkout"
- allows checkout to be performed as simply asgit co <filename>.

Github Basic Workflows
Github requires its own basic workflow to be properly used. It works as follows:
- Create a branch
- Commit a change
- Create a pull request
- Review the pull request
- Merge and delete branch
Following this pattern of work ensures conflicting code is not adopted into a singular project.
Github Workflow diagram
This workflow combined with basic Git should look something like this.
- Create a Git repository, i.e.
git init
- Stage files that you will be updating i.e.
git add filename
git add -A
will add all changes within the repository to the stage.- Commit changes i.e.
git commit -m "....."
- Connect local repository to remote GitHub respository, i.e.
git remote add origin <repository_url>
- Push changes to the remote repository (Github) i.e.,
git push -u origin main
- Create a branch off the main repository i.e.
git branch <branch name>
- Alternatively, open an existing branch i.e.
git checkout <branch>
- Make changes to the branch, and then push it to Github, i.e.
git push origin <branch name>
- Create a pull request. This is done on Github.
- Merge the branches into the main i.e.
git merge <branch>
- Refresh your local files with the updated main branch, i.e.
git pull origin main
Using Markdown
Markdown is a simplified way to type and format simple text that also allows a parsing program to format it into HTML. It lacks the complexity of HTML, although it contains some of the same formatting options (bold, italics, lists, etc.) This makes it very accessible to even those who don't know HTML.
How does it work?
Create a file with markdown syntax and save it with the extension .markdown or .md.



When should I used markdown?
- The only editor available to you supports just plain text.
- Time is of the essence and you can't afford to learn how to use an unfamiliar rich-text editor.
- You need to quickly outline your ideas in a structured but presentable manner.
- You want your document to be portable so that it can convert to HTML, PDF, EPUB, and/or MOBI.