Git Cheat Sheet 2
Check the status of the repository
$ git status
# Check the status of the repository, to see what the state of our project is.
Create a Directory
$ mkdir my_git_project
# create a directory where we’ll store the files for our project:
$ cd my_git_project
# changes the active directory to the newly created one
Initializes a git repository
$ git init
# Initializes a git repository – creates the initial ‘.git’ directory in a new or in an existing project.
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new empty repository. Most of the other Git commands are not available outside of an initialized repository, so this is usually the first command you’ll run in a new project.
Creates an empty Git repository - basically a .git directory with subdirectories for objects, refs/heads, refs/tags, and template files. An initial HEAD file that references the HEAD of the master branch is also created.
Show file in working tree
$ git ls-files
# Show information about files in the index and the working tree
History of the project
$ git log
# The history shows the list of commits, each with a unique hash, an author, a timestamp and a commit message.
Synchronize it with the remote repository
$ git remote add origin https://github.com/yourgitname/my_git_project.git
$ git push -u origin master
# synchronize it with the remote repository: