赞
踩
1:本地创建文件夹projectName
2:进入projectName,点击鼠标右键,选择Git Bash,在Git Bash中执行下面的命令:
- //git初始化
- git init
- //与远程代码仓库建立连接,代码仓库地址 https://xxx
- git remote add origin https://xxx
- //将远程分支拉到本地:OriginBranchName为远程分支名
- git fetch origin OriginBranchName
- //创建本地分支:LocalBranchName为本地分支名
- git checkout -b LocalBranchName origin/OriginBranchName
- //将远程分支拉取到本地
- git pull origin OriginBranchName
3:本地commit注释,不提交到主分支上:
git checkout master //切换回主分支
git pull origin master //拉取远端master代码
git merge --squash origin/分支名 //--squash 会暂停commit提交。
git commit -m "这里是注释"
git push origin master //提交master代码到远端
4:删除远程分支的提交记录
git reset --hard 38679ed709fd0 #恢复到某一次提交
git push origin master -f #reset 后push,远程某次提交后的日志,就都删除了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。