mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-25 04:17:17 +00:00
docs: 批量博文
This commit is contained in:
68
Chapter7 - Geek Talk/7.3.md
Normal file
68
Chapter7 - Geek Talk/7.3.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# git常见使用
|
||||
|
||||
```
|
||||
http://blog.csdn.net/wirelessqa/article/details/20153689
|
||||
```
|
||||
|
||||
1. git init
|
||||
2. git add .
|
||||
3. git commit -am "\#\#\#"
|
||||
4. git remote add origin git@xx.xx.xx.xx:repos/xxx/xxx/xxx.git
|
||||
5. git push origin 本地分支:远程分支
|
||||
fatal: refusing to merge unrelated histories
|
||||
决办法:git pull origin master --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 还是会存在上传不成功的情况,所以需要严格按照下面的顺序执行
|
||||
|
||||
```Shell
|
||||
//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 master
|
||||
//10
|
||||
git add /Users/liubinpeng/Desktop/Github/Company-Website-Pro/video/Company-Website-Pro.mov
|
||||
//11
|
||||
git commit -m 'video'
|
||||
//12
|
||||
git push origin master
|
||||
|
||||
```
|
||||
|
||||
## 代码回滚到某个 tag
|
||||
|
||||
- 先查看所有的 tag: `git tag`
|
||||
- 查看需要回滚的 tag 对应的 commitid: `git show {tag号}`
|
||||
- 回滚: `git reset --hard {commitId}`
|
||||
Reference in New Issue
Block a user