WebRef.eu  - Internet Marketing and Online Business Resources  

Home / Site Map | Contact


Git and GitHub Notes

Git is a version control system. It tracks all the changes that you make.

Git Bash is a Git tool for Windows. Once you have installed Git Bash, you will be able to browse to your directory that contains your software project, right click and select "Git Bash Here" to control your project with Git.

GitHub is the online Hub where you commit your files for everyone to use.

The Pro Git book, available for free online, will also be useful to you for learning Git.

Initial GitHub Setup Process

Create an account on GitHub.

On Windows, install Git Bash. Once you have installed Git Bash, you will find it in a Git folder in your Apps.

Video - Installing Git Bash

Setup your username and password locally using Git Bash.

So you don't have to type in your password every time you connect to Git Hub, setup your local Git with an SSH key.

Check for an existing SSH key with:

ls ~/.ssh

Create a private and public SSH key, and give Git Hub the public key.


Check SSH is setup correctly using:

ssh -T git@github.com

How to Start a New Local Git Repository


Making Your First Local Commit with git commit

Git Handbook


GitHub Video Tutorials


Learn Git Video

GitHub Basics - The GitHub Workflow


git add .

Will add all the changes that you've made to the project. You then need to commit them, it's a two step process. The commit is taking a snapshot.

git commit -m "Your message here"

Git Stages

File as your working copy.

git add - adds it to the staging area.

git commit - commits the file to the local repository.

git push - uploads your changes to GitHub.

GitHub Workflow Video

Git - How to Edit Files

Git Tutorial - How to View the Changes Made to Files

Learn Git and GitHub - Crash Course Video

Git Bash Commands

Show Git Config Info

git config --list

Show Current Directory git Is In


Cycle Through Previous Commands

Note, Up arrow will cycle you through your previous commands to save you typing.

Show All Files in Current Directory


Clear Screen


To Open Git Bash at Correct Directory

Browse into the directory in Explorer, then right click and select Git Bash here.

Set Username and Password

Note, use your GitHub username and e-mail when entering these commands:

git config --global user.name "Your name here"
git config --global user.email "your_email@example.com"

To check Username and Password set correctly:

git config --list

Note, each time you submit to GitHub, you will need to type in your password. If you don't want to do this each time, you can set up an SSH key.

Initialize Git for a New Project

Run the git init command from the folder that contains all of your project files.

See https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init

This will add a .git folder.

Add Files to Staging

git add

Commit Changes

git commit

View Commit History

git log

View Commit History from a Particular Person

git log --author="Person"

View Status

git status

Show Differences Between Your Working Copy and the Repository

git diff

Pulling Changes

git pull

Copies everything from the remote repository to your computer.

Upload Changes to a Remote Repository on GitHub / Add a Project to GitHub

get push

See https://www.atlassian.com/git/tutorials/syncing/git-push

See https://help.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line

Creating a New Git Repository

Open git bash.

Change directory to the directory where you want the Git repo (use cd command).

Then use:

git init

command. Which will create a .git directory within your target directory.



Visit LowPrices.co.uk for Your UK Shopping

How To Submit Your First Pull Request on GitHub


GitHub Explore
Helps you find interesting content on GitHub.

Using GitHub with Visual Studio Code

Git Hub Books

The Pro Git book, available for free online.




Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk

Home / Site Map | Contact

All Content ©2020 WebRef.eu