Git 常用命令

基础

命令WindowsMac
查看状态git statusgit status
暂存改动git add .git add .
提交改动git commit -m "msg"git commit -m "msg"
历史图git log --oneline --graph --decorate --allgit log --oneline --graph --decorate --all

分支与合并

命令WindowsMac
创建并切换分支git checkout -b feature/xgit checkout -b feature/x
切换至主分支git switch maingit switch main
合并主分支git merge maingit merge main
变基git rebase maingit rebase main