Git 常用命令

56 阅读1分钟
# create git repositories
git init

# 查看本地没有在缓冲区的文件
git diff

# 查看本地在缓冲区的文件,即add 还没有 commit
git diff --cached

# help
git help
git <cmd> -h

# checkout
git checkout -- fileName
git checkout .

# add files or folders
git add <name>
// add all
git add .

# log and status
git log
git status

# clone
git clone <url>

# commit
git commit -m "message"

# push
git push origin <name>

# pull and merge
git pull master:<name>

# fectch
git fetch orgin master

# branch
git branch <name>
git checkout -b <name>
git branch

# delete branch
git push origin --delete master
git branch -D <name>

# checkout
git checkout <name>

# merge
git merge <name>

# reset 
git reset ID

# stash
git stash