git学习使用游戏小笔记
联系网站:Git 学习在线教学
1.与远程库连接
git remote -v //查看远端库
git remote add origin https://github.com/XuedongWu/TYcamera_Dirver.git //连接远端库
// origin 为默认远端库的名称,可自行定义远端库
// 删除远程库
git remote remove name_reposity
2.新建本地分支,推送到远端库
git branch new-branch-name
git checkout new-branch-name
//上面的两条指令可以合并成一条
git checkout -b new-branch-name
git add .
git commit -m "message"
git push origin new-branch-name
3.强制上传
git push origin +master
4.返回以前版本
git reset --hard HEAD
// 这是取消的 git status 中的更改,
git reset --hard HEAD^
// 返回上个commit的版本
git reset --hard HEAD~Num
5.新建分支,以及指定commit
git branch new-branch
// 新建分支名字
git branch new-branch commit id
// 新建分支 并指定版本
6. 合并分支
- 法一:get merge
git merge other-branch aim-branch
- 法二:git rebase
git rebase