Home Linux HTML/CSS PHP React VR Blog T-Shirt Shop PHP Fiddle

Intro to Git / GitHub









If you find my tutorials helpful, please consider donating to support my free web development resources.

The more money I raise, the more content I can produce.

Thank you,
Commander Candy

DONATE

Intro to VI / VIM:

Intro to VI - Basic Commands:


What is LAMP?

Intro to LAMP:


Create your own LAMP environment:

Create a LAMP Programming Environment:


Linux/LampInto to Git

In this lesson, you will learn how to use git for version control and project management. If you do not have a Linux environment set up, visit: Setting up LAMP Lessons


What is git?

Git is a method of version control. This means it helps you control and manage the constant changes that you will make to your code.


You can use Git to create a local repository (aka repo) for your project.


What is a repository?

A git repository is basically a place to store your project. It is like a hidden directory.


Git File Systems

Git files are stored and organized, simularly to Linux Files. Do you remember the Linux File System (Intro to Linux Video)? Git uses a simular system.

Git stores your files as either tree or blob objects. Trees are simular to Linux directories and blobs are simular to Linux files.


Installing git (Linux)

Ubuntu (Debian):

$ sudo apt-get install git-all

Other flavors:

$ sudo dnf install git-all

More Information:

To look up downloadss for your specific distro: git downloads

Cisco Learning Network Store

Configure

Changing Text Editor

You probably want to set the git text editor to your favorite editor. I use vi/vim in my tutorials, so in the example below I am changing the editor to vim.

$ git config --global core.editor "vim"

Name and Email

$ git config --global user.name "candy66"
$ git config --global user.email codingcommanders@gmail.com

config name Put your name here
config email Put your email here.


Creating a Git Repository

Step 1: Goto the directory

First, you want to cd (change directory) to the directory that contains your project

Let's say your project is locatated in: /var/www/html/projects


$ cd /var/www/html/projects

cd Change directory
projects To the directory named projects.
projects is a subdirectory of html. html is a subdirectory of www and www is a subdirectory of var. var is located in the root directory.


Step 2: Create an Empty Repositoy

$ git init

git init Creates an empty repo


Step 3: Add Code to the Repo

$ git add .

git add Updates the tree index and prepares for commit
. Add all files in current directory.


You can specify what file you want to add.

$ git add file.php

git add Updates the tree index and prepares for commit
file.php file.php is the file we are adding.


Step 4: Git Commit

$ git commit

git commit You will be prompted to enter a message regarding the version. Your git repo will be updated with the current version.


Additional Git Commands

Here are more useful git commands!

git status

$ git status

git status gives useful info about the files that you are preparing.

git log

$ git log

git log shows you past commit dates and comments. See the example below.



git version

$ git version

git version will tell you the installed version of git.


GitHub

GitHub is a web based git repo. Using git will locally apply version control to your projects. GitHub provides an online backup of your versioning and allows you to connect with other developers/projects.

The code for Coding Commanders projects will be avilable on the Coding Commanders GitHub.

Coding Commanders Storyline:

Coding Commanders Story


Watch the Coding Commanders LAMP Animation:

Coding Commanders: Episode 1


Check out my blog:

Coding Commanders Blog


Color Selector



Hex:


RBG:


Follow Coding Commanders on:

YouTube

GitHub

Facebook

Instagram

Twitter

Applied Assignment

Purpose: In this assignment, we are preparing to begin out First web application project.
Assignment:
1) Make the directory: /var/www/html/projects/datingApp
2) Inside datingApp, create a file called index.php or index.html
3) Create a git repo for this directory
4) Add index.html to your repo
5) Push the code to your GitHub account
What's next? In my next video, we will build an application that calculates someone's datibility score!