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:
Create a private and public SSH key, and give Git Hub the public key.
Check SSH is setup correctly using:
ssh -T firstname.lastname@example.org
How to Start a New Local Git Repository
Making Your First Local Commit with git commit
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"
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
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"
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.
This will add a .git folder.
Add Files to Staging
View Commit History
View Commit History from a Particular Person
git log --author="Person"
Show Differences Between Your Working Copy and the Repository
Copies everything from the remote repository to your computer.
Upload Changes to a Remote Repository on GitHub / Add a Project to GitHub
Creating a New Git Repository
Open git bash.
Change directory to the directory where you want the Git repo (use cd command).
command. Which will create a .git directory within your target directory.
How To Submit Your First Pull Request on GitHub
Git Hub Books
The Pro Git book, available for free online.
All Content ©2020 WebRef.eu