/// 文件添加和提交
git add file
git commit -m "备注"
/// 查看修改
git status
git diff file
/// 日志
git log
git log --pretty=oneline
/// 撤销修改
git checkout -- file 回退工作区 working directory
git reset HEAD file 回退暂存区 stage
git reset --hard 文件版本(git log的commit id) 版本回退 master
/// 文件删除
git rm file
/// 生成ssh key
ssh-keygen -t rsa -C "email"
/// 关联远程库
git remote add "remote name;default origin" "git address"
/// 克隆远程库
git clone "git address"
/// 将本地代码推送到远程库 local repo => remote repo
git push "remote name" master/develop(branch name)
/// 新建分支
git branch "name"
git checkout "name"
/// 把开发的暂存
git checkout "name"
git stash
/// 恢复stash
git stash pop/apply
git stash drop
/// 强制删除分支
git branch -D "name"
/// 查看文件的修改记录
git log -- filename,获得commit id
git show commitId -- filename
网友评论