1、常用命令记录
1)切换分支
git checkout 分支名
2)查看分支
查看远程分支
git branch -r
查看所有分支包括本地分支和远程分支
git branch -a
3)合并分支
git merge 来源分支
4)删除分支
删除本地分支:git branch -D 分支名
删除远程分支:git push origin --delete 分支名
5)创建并切换到新分支
git checkout -b 新分支名
//然后提交的时候需要输入
git push --set-upstream origin 新分支名
6)撤回commit
git reset --soft HEAD^
7)暂存修改
将在当前分支修改的内容放到缓存区中,并会自动建立一个缓存的list集合。
git stash save "添加console.log"
git stash list //可以看到list下的所有缓存。
git stash pop //将当前分支的最后一次缓存的内容释放出来,但是刚才的记录会被删除,不存在list中
git stash clear //不想要本地的更改了,可以使用该命令清除所有的stash栈
8)提交修改
git add .
git commit -m'提示文案'
git push
2、使用中遇到的问题总结
1)git clone报错:
Please make sure you have the correct access rights and the repository exists.