未验证 提交 1ca96b29 编写于 作者: RunAtWorld's avatar RunAtWorld 提交者: GitHub

Update gitcmd.md

上级 62ee2a92
......@@ -152,6 +152,14 @@ git push origin :refs/tags/v1.0.0 #删除github远端的指定tag
git push origin --delete v1.0.0
```
### git reset
```
git reset --mixed <指定版本HASH> #不删除工作空间改动代码,撤销commit,并且撤销git add . 操作
#这个是默认参数,git reset --mixed HEAD^ 和 git reset HEAD^ 效果是一样的。
git reset --soft <指定版本HASH> #不删除工作空间改动代码,撤销commit,不撤销git add .
git reset --hard <指定版本HASH> #删除工作空间改动代码,撤销commit,撤销git add . ,恢复到了上一次的commit状态
```
### 查看状态与日志
1. 查看状态
```
......@@ -171,8 +179,6 @@ git log --no-merges origin/dev #列出远程dev分支没有合并前的变化
```
git checkout . #本地所有修改的。没有的提交的,都返回到原来的状态
git stash #把所有没有提交的修改暂存到stash里面。可用git stash pop回复。
git reset --hard <指定版本HASH> #返回到某个节点,不保留修改。
git reset --soft <指定版本HASH> #返回到某个节点。保留修改
git clean -df #返回到某个节点
git clean 参数
......@@ -248,6 +254,11 @@ git commit --allow-empty -m 'wiki deleted'
git push origin empty:master --force
```
### 4. 如果commit注释写错了,只是想改一下注释,只需要:
```
git commit --amend
```
### gitignore 说明
```
# 表示此为注释,将被Git忽略
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册