git branch 系列
git branch
git branch -r
git branch -a
git branch -D xxx
git checkout -b xxx
git checkout -b xx origin/xxx
取一个名字
git fetch
git fetch origin (任何分支)master:temp
从远程的origin仓库的xxxx分支下载到本地并新建一个temp分支
如果用了pull拉取 会自动merge
git pull origin master
git clone
$ git clone -b branchname [email protected]
强制覆盖远程
git push origin 分支名 --force
远程来覆盖本地
git pull origin 分支名
但是很多人不推荐用git pull 推荐先git fetch 再 git merge 】
以防自己被冲突坑害了
这个blog我举得写的很好 对于每个代码背后的意义有解释
https://www.cnblogs.com/ruiyang-/p/10764711.html
抛开我所有的暂存和未分离的更改,忘记当前本地分支上的所有内容,并使其完全相同作为 origin / master
git reset --hard origin / master (可以不是master可以是任何其他分支)