git相关
设置个人信息
git config --global user.name "<名字>” git config --global user.email "<邮箱>”重置个人信息
git config --global --replace-all user.name "<名字>" git config --global --replace-all user.email "<邮箱>"创建密钥
ssh-keygen -t rasa -C “<邮箱>”Mac的密钥存储位置
~/.ssh删除本地分支
git branch -d <分支>删除远程分支
git push origin --delete <分支>查看所有分支,包括本地和远程
git branch -a创建本地分支并切换
git checkout -b <分支>切换本地分支
git checkout <分支>查看追踪分支
git branch -vv提交更改到暂存区
git add <文件>撤销暂存区更改
可以先通过 git status查看,有一些提示
git reset HEAD <文件>查看暂存区的内容与原文件的区别
git diff查看暂存区的内容与上次提交的区别
git diff --cached提交更改到本地
git commit -m "<更改注释>”查看所有提交
git log查看所有历史操作
git reflog回到某个提交状态
git revert <标记> git reset <标记>撤销revert
git revert --abort更新本地仓库至远程仓库的最新改动
git pull合并其他分支至当前分支
git merge <分支>覆盖远程分支
git push origin <远程分支> --force本地已有项目与远程空项目关联
git init git remote add origin git@github.com:[用户名]/[项目名].git设置本地与远程的通道
git branch -u origin/[远程分支] git branch --set-upstream-to=origin/[远程分支]设置本地与远程的通道并推送
git push -u origin [远程分支] git push --set-upstream origin [远程分支]还原工作区内容
git stash还原“还原工作区内容”
git stash apply