🎨
This commit is contained in:
parent
1f64fc8d3f
commit
a0c8576166
@ -46,3 +46,41 @@ git merge --allow-unrelated-histories <branch_name>
|
|||||||
```
|
```
|
||||||
|
|
||||||
这个命令将允许你合并两个没有共同历史的分支。如果有冲突发生,需要解决冲突并手动提交合并结果。
|
这个命令将允许你合并两个没有共同历史的分支。如果有冲突发生,需要解决冲突并手动提交合并结果。
|
||||||
|
|
||||||
|
### 4.查看某个文件提交记录
|
||||||
|
|
||||||
|
要查看文件在Git中的提交记录,可以使用以下命令:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git log -- <file_path>
|
||||||
|
```
|
||||||
|
|
||||||
|
其中<file_path>是您想要查看提交记录的文件路径。这个命令将显示指定文件的提交历史,包括提交者、提交信息、提交时间等信息。
|
||||||
|
|
||||||
|
如果您只想查看最近的提交记录,您可以使用-n选项来指定要显示的提交记录数量,例如:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git log -n 5 -- <file_path>
|
||||||
|
```
|
||||||
|
|
||||||
|
这将显示最近的5次提交记录。
|
||||||
|
|
||||||
|
另外,如果您想查看某个特定文件在每次提交中的变更,您可以使用以下命令:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git log -p -- <file_path>
|
||||||
|
```
|
||||||
|
|
||||||
|
这个命令将显示每次提交对指定文件所做的具体变更。
|
||||||
|
|
||||||
|
### 5.从远程切除分支并关联
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout -b <branch_name> <remote>/<branch_name>
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git checkout --track <remote>/<branch_name>
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user