git本地仓库分支和远程仓库分支的同步及删除
文章目录
命令:
//远程仓库已删除分支,本地git branch -a还会有缓存分支信息,使用:
git remote prune origin
//删除本地分支
git branch -d/-D <分支>
//删除远程分支
git push origin --delete <分支>
//新建tag并推送
git tag -a <版本> -m ""
git push origin
//查看git提交版本
git log
//回退版本
git reset --hard <版本号>
//强推
git push -f
## 在本地新建一个temp分支,并将远程origin仓库的master分支代码下载到本地temp分支;
$ git fetch origin master:temp
## 比较本地代码与刚刚从远程下载下来的代码的区别;
$ git diff temp
## 合并temp分支到本地的master分支;
$ git merge temp
## 如果不想保留temp分支,删除;
$ git branch -d temp
//已有本地分支创建关联
git branch --set-upstream-to origin/远程分支名 本地分支名
##拉取指定远程分支
git checkout -b 本地分支名 origin/远程分支名
//常用基础
git branch -a
git branch <分支>
git checkout
git checkout -b <分支>
git merge <分支>
git push
git pull
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论