1.新建仓库:
git init2.添加并提交文件
git add read.txt
git commit -m "this is the first commit"
3.查看日志
git log
git log --pretty=oneline
git log --graph --pretty=oneline --abbrev-commit
4.版本控制
git reset --hard HEAD^^
git reset --hard d07515
5.删除文件
rm test.txt
git rm test.txt
git commit -m "remove test.txt"
(or)
git checkout --test.txt
6.分支管理
查看分支
git branch
新建并进入分支 feature
git checkout -b feature
新建分支 feature
git branch feature
进入分支 feature
git checkout feature
删除分支 feature
git branch -d feature
返回master分支
git checkout master
7.现场管理
git stash
git checkout master
git checkout -b tem
#do some thing
git checkout master
git merge --no-ff -m "temp tesk fixed" tem
git branch -d tem
git stash pop
#多个现场
git stash list
(git stash apply stash@{0})
8.标签操作
git tag v1.0
git tag v0.8 265456ed5
9.远程操作
git pull
git remote add origin git@github.com:yourusername/yourproject.git
git push origin feature
git clone "some site.git"