mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-25 12:27:15 +00:00
1.4 KiB
1.4 KiB
git常见使用
http://blog.csdn.net/wirelessqa/article/details/20153689
- git init
- git add .
- git commit -am "###"
- git remote add origin git@xx.xx.xx.xx:repos/xxx/xxx/xxx.git
- git push origin 本地分支:远程分支
fatal: refusing to merge unrelated histories
决办法:git pull origin main --allow-unrelated-histories
创建新版本
- 从现有的分支创建新分支
- git checkout -b dev
- 将新创建的分支提交到远端
- git push origin dev
- 提交代码
- git add .
- git commit -m 'add a new branch named dev'
- git pull origin dev
- git push origin dev
Githubu 不允许上传超过 100MB 文件
关键点:
- git-lfs 添加允许上传的文件名称或者文件类型
- 如果按照顺序1-2-3-4-5-6-10-11-12 还是会存在上传不成功的情况,所以需要严格按照下面的顺序执行
//1
git rm --cached -r video/Company-Website-Pro.mov
//2
git commit --amend
//3
git push
//4
brew install git-lfs
//5
git lfs install
//6
git lfs track "*.mov"
//7
git add .gitattributes
//8
git commit -m '.gitattributes'
//9
git push origin main
//10
git add /Users/liubinpeng/Desktop/Github/Company-Website-Pro/video/Company-Website-Pro.mov
//11
git commit -m 'video'
//12
git push origin main
代码回滚到某个 tag
- 先查看所有的 tag:
git tag - 查看需要回滚的 tag 对应的 commitid:
git show {tag号} - 回滚:
git reset --hard {commitId}