命令 | 说明 | 备注 | |
---|---|---|---|
git log | 命令显示从最近到最远的提交日志,我们可以看到3次提交 | ||
git log--pretty=oneline | 输出简洁 | ||
git add | 文件修改添加到暂存区 | ||
git commit -m "说明" | 所有内容提交到当前分支 | ||
git status | 查看一下状态 | ||
git checkout -- file | 可以丢弃工作区的修改 例如: $git checkout --readme.txt | 注:-- 没有的话 会切换分支 |
|
git rm file | 删除文件 $git rm readme.txt | ||
git push | 将本地分支内容推送到远程上 | 如果远程为空 加上-u | |
git colne | 克隆一个本地库 | ||
git branch <name> | 创建分支 | ||
git checkout <name> git switch <name> |
切换分支 | ||
git checkout -b <name> git switch -c <name> |
创建+切换分支: | ||
$ git branch dev 创建dev | |||
$ git checkout dev 切换到dev | |||
git branch | 查看当前分支 | ||
git branch -d <name> | 删除分支 | ||
git merge <name> | 合并某分支到当前分支 | ||
$ git branch -D <分支> | -D强删分支 | ||
git push origin <分支> | 推送到分支 | 推送失败 用git pull | |
git pull | 抓取下远程新提交 |
git 常用总结
猜你喜欢
转载自blog.csdn.net/LiXiaolian_xg/article/details/100932101
今日推荐
周排行