GIT命令提交 、冲突处理、撤销误提交文件
一、常用命令
pull status stash add commit push reset head
二、常规更新提交操作
1.更新
git pull
2.状态
git status
3.添加上传文件
git add
例:
git add fileName.java
4.提交,注释
git commit -m "注释"
5.推送
git push
三、冲突解决
1.更新
git pull
因冲突,此处应该会提示有冲突文件
2.隐藏本地文件
git stash
3.更新
git pull
此时会有更新文件的信息
4.还原隐藏文件
git stash apply stash@{0}
另一种写法
git stash pop stash@{0}
我用的是第一种
还原后会显示冲突文件信息,有可能也会没有冲突 。剩下的就跟提交一样了
5.添加上传文件
git add
6.提交,注释
git commit -m "注释"
7.推送
git push
四、撤销误添加的文件
1.查看提交文件状态
git status
2.撤销文件
git reset HEAD
例:
git reset HEAD fileName.java
如果不后边的文件名,会全部撤销