1. 程式人生 > >Git常用命令(區別於基礎命令的進階版)

Git常用命令(區別於基礎命令的進階版)

# 常用gitlab命令


1. 合併程式碼,並採用別人的版本
```
git merge --strategy-option=theirs <branch>
```


2. 合併程式碼,並採用自己的版本
```
git merge -s ours <branch>
```


3. 提交時轉換為LF,檢出時轉換為CRLF
```
git config --global core.autocrlf true
```


4. 提交時轉換為LF,檢出時不轉換
```
git config --global core.autocrlf input
```


5. 提交檢出均不轉換
```
git config --global core.autocrlf false
```


6. 拒絕提交包含混合換行符的檔案
```
git config --global core.safecrlf true
```


7. 允許提交包含混合換行符的檔案
```
git config --global core.safecrlf false
```


8. 提交包含混合換行符的檔案時給出警告
```
git config --global core.safecrlf warn
```


9. 檢視當前分支合併的分支(剔重)
```
git log --merges --oneline|awk {'print $4'}|sort -u
```