|
1234567891011121314151617181920212223242526272829303132 |
- > 出现非常混乱的情况,首先本地回滚到某个版本:
- ```
- git reset xxx --hard
- ```
- 然后让远程也回滚
- ```
- git push origin master -f
- ```
-
- > 查看最近记录
-
- ```
- git log --since=1.days
- git log --since=1.weeks
- git log -p -2 --oneline
- ```
-
- > Please commit your changes or stash them before you merge. 场景是不想把本地的一个修改文件提交上去
-
- ```
- git stash
- git pull
- git stash pop
-
- 另外:
- git stash list
- git stash clear
- ```
-
- > 删除缓存区的内容
-
- 正确的做法应该是:git rm --cached logs/xx.log,然后更新 .gitignore 忽略掉目标文件,最后 git commit -m "We really don't want Git to track this anymore!"
|