基本用法 源状态 –modify–>工作区 –add–>暂存区 –commit–>(本地仓库)–push–>远程仓库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 git init git log git reflog git add file_name git add --all git add . git status git commit -m "commit_message" git commit --amend git rebase -i HEAD~6 git checkout --file_name git checkout . git revert -n commit_id git reset (--mixed) HEAD git reset (--mixed) HEAD file_name git reset --soft HEAD^ git reset --hard git reset --hard HEAD^ git reset --hard commit_id git fsck --lost-found
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 git remote add name URL git push origin first:master git push -f git pull origin first:master git fetch origin master git merge origin/master git fetch orgin master:tmp git diff tmp git merge tmp git rebase master git branch -r/-a git branch tmp git checkout tmp git branch -d tmp git push orgin --delete tmp
git reset
-–hard 强制回退版本,不保留工作区和暂存区的修改。
–soft 回退到某一版本,保留工作区和暂存区的修改。
–-mixed(默认) 回退到某一版本,保留暂存区的修改,不保留工作区的修改。
git revert git rebase https://blog.csdn.net/weixin_42310154/article/details/119004977
https://baijiahao.baidu.com/s?id=1633418495146592435&wfr=spider&for=pc
git stash/unstash