Lingceng's Blog

Git Get Started

Config name and email

git config --global "John Doe"
git config --global ""

Get help

git config --help
git help config
man git-config

Start up

git init
git add .
git commit -m "Depot Scaffold"

add and commit
git commit -a -m "Depot Scaffold"


git diff HEAD^ HEAD

# show diff stat
git diff --stat

# show the tree-like view
git log --graph --oneline --all

Specify the file path

git diff HEAD^ HEAD app/models/product.rb

Git ammend the last commit

git commit -amend

Powerful edit commit command

git rebase --interactive HEAD^5

Git include delelted files

git add -A

Creates a remote named “origin” pointing at your GitHub repository

git remote add origin

Sends your commits in the “master” branch to GitHub

git push origin master

Pull down changes

git pull orgin master