#clone从远端到本地
git clone $link
#fetch更新所有repo,并使用pull拿去最新代码
git fetch
git pull
#查看当前代码状态和改动情况,添加改动到本地git并保存
git status
git diff $path
git add $path
git commit -m "xxx"
#单独使用push会更新到默认分支,当分支不存在会新建分支
git push
git push origin $local:$Remote
#切换分支
#切换之前记得保存
git stash save "xxx"
git stash list
git checkout $branch
#新建分支
git checkout -b $branch
#删除分支
git branch -d $branch
#查看所有分支
git branch -a
#查看提交记录, 加-n可以决定查看提交次数
git reflog
#释放缓存
git stash pop stash@{$target}
git stash apply stash@{$target}
Git常用命令总结
于 2023-12-16 00:55:51 首次发布