GIt 错误与命令

命令和一些其他的属性等

*)git后面括号中的(master->gitee)的颜色

红色代表本地和远程(通过git pull)的有冲突、或者unmerge paths

浅黄色代表未提交

 

*)当某个命令会有多行输出结果时,git 会出现一个“:”号,按Enter会输出下一行,End直接到末尾,Home向上一页,q退出

diff --cc .gitignore                                                                
index 20d7888,11614af..0000000                                                      
--- a/.gitignore                                                                    
+++ b/.gitignore                                                                    
@@@ -1,6 -1,115 +1,124 @@@                                                          
++<<<<<<< HEAD                                                                      
 +#python                                                                           
 +forTest.py                                                                        
 +Git_bubble_sort_matplotlib.py                                                     
 +Git_data.py                                                                       
 +Git_output_matplotlib.py                                                          
- __pycache__                                                                       
++__pycache__                                                                       
++=======                                                                           
+ # Byte-compiled / optimized / DLL files                                           
+ __pycache__/                                                                      
+ *.py[cod]                                                                         
+ *$py.class                                                                        
+                                                                                   
+ # C extensions                                                                    
+ *.so                                                                              
+                                                                                   
+ # Distribution / packaging                                                        
+ .Python                                                                           
+ build/                                                                            
+ develop-eggs/                                                                     
+ dist/                                                                             
+ downloads/                                                                        
+ eggs/                                                                             
+ .eggs/                                                                            
+ lib/                                                                              
+ lib64/                                                                            
+ parts/                                                                            
+ sdist/                                                                            
+ var/                                                                              
+ wheels/                                                                           
+ share/python-wheels/                                                              
+ *.egg-info/                                                                       
+ .installed.cfg                                                                    
+ *.egg                                                                             
+ MANIFEST                                                                          
+                                                                                   
+ # PyInstaller                                                                     
+ #  Usually these files are written by a python script from a template             
+ #  before PyInstaller builds the exe, so as to inject date/other infos into it.   
+ *.manifest                                                                        
+ *.spec                                                                            
+                                                                                   
:                                                                                   

  

*)在git status命令时显示的Untracked files ... 代表未使用git add 添加进去,可以在Git工作区的根目录下创建一个特殊的.gitignore文件,然后把要忽略的文件名填进去,Git就会自动忽略这些文件。

*)(不确定)对远程操作时都要带上origin关键字 不对,origin是默认的远程库的名字

*)一些解释

λ git log --graph --pretty=oneline --abbrev-commit
* 836a213 (HEAD -> master, origin/master, origin/dev2) study cooperation#类似这些提示是所有的提交,包括所有文件的提交,这些提交中有的是对文件A的改动,有些是对文件B的改动,有些是对一批文件的改动
* 59b2b66 学习bug分支
* e0d028a 检查是否删除后依然能看出合并过
*   61f64f3 merge with no-ff
|\
| * 5c287fe modify this
|/
*   127f749 conflict fixed
|\
| * fb4d959 and simple
* | 466aa52 & simple
|/
* a8a3763 don't konw what
* b0bb2c9 add new line
* 389efcb banch test
* e9db995 add test.txt
* 22ccc69 git trackes(跟踪器) change
* 2561b39 理解stage怎么工作的
* 7acc523 '再次修改readme.txt'
* c72e38e '添加了单词distributed'
* 06bcd78 '添加了三个文件'
* b30fedb 创建了一个readme.txt

问题

*)git pull 时失败 fetal:refusing to merge unrelate histories:

参考链接:https://blog.csdn.net/lindexi_gd/article/details/52554159

Git会检查github 的仓库和本地的没有一个共同的 commit 所以 git 不让提交,认为是写错了 origin ,如果开发者确定是这个 origin 就可以使用 --allow-unrelated-histories 告诉 git 自己确定

C:\Users\Administrator.SC-202132\Envs\sort\app (master -> gitee) 
λ git pull                                                             
fatal: refusing to merge unrelated histories                           
                                                                       
C:\Users\Administrator.SC-2012\Envs\sort\app (master -> gitee) 
λ git pull --allow-unrelated-histories                                 
Auto-merging .gitignore                                                
CONFLICT (add/add): Merge conflict in .gitignore                       
Automatic merge failed; fix conflicts and then commit the result.      

  

错误

*)刚创建本地仓库时如果不添加文件,使用git branch 不显示master分支的

*)git commit -m后面紧跟的说明中如果时中文或者中英文混合的应该用双引号

λ git commit -m "git trackes(跟踪器) change"有中文时应该用双引号
[master 22ccc69] git trackes(跟踪器) change
 1 file changed, 2 insertions(+), 1 deletion(-)

  

 

转载于:https://www.cnblogs.com/Gaoqiking/p/11112513.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值