github使用总结

来源:互联网 发布:oppoa77t怎么切换网络 编辑:程序博客网 时间:2024/05/20 23:30
You won't be able to pull or push project code via SSH until you add an SSH key to your profile

解决方式(只针对linux用户,windows用户请自查):http://blog.csdn.net/hustpzb/article/details/8230454/

切换版本+拉取最新数据+本地提交+远程提交
[plain] view plain copy
 print?
  1. git checkout f-fixonlinetimebug  
  2. git merge dev  
  3. git add filename  
  4. git commit filename -m "xxxxxx"  
  5. git push origin f-fixonlinetimebug  
  6. git push origin f-appupdate  

查看所有branch版本
[plain] view plain copy
 print?
  1. git branch -a  

//切换到dev合并代码,提测完毕后才能执行
[plain] view plain copy
 print?
  1. git checkout dev  
  2. git merge f-fixonlinetimebug  
  3. git push origin dev  

//查看配置信息
[plain] view plain copy
 print?
  1. git config --list  

//创建远程分支(test在远程本来是没有的,只是因为我push一下才有的)
[plain] view plain copy
 print?
  1. git push origin test  

//fatal: cannot do a partial commit during a merge.
[plain] view plain copy
 print?
  1. git commit -i [冲突文件]  

git恢复本地修改文件(相当于svn revert filename)
[plain] view plain copy
 print?
  1. git checkout index.php  
  2. 如果已经放到暂存里面了  
  3. git reset HEAD -- index.php  
  4. 如果已经放到HEAD里面了(注意这里面有坑,不小心会把数据搞没有的)  
  5. git log 查看log版本号  
  6. git reset --hard 1d8074beb15a2e074c9b565c4c94bc2a97567b94  
  7. git reset --hard  
  8. git pull  


Git切换到远程分支?

[plain] view plain copy
 print?
  1. git checkout -b niuyufu  

git删除分支
[plain] view plain copy
 print?
  1. git branch -d niuyufu  

[Git] Fatal: cannot do a partial commit during a merge

解决方法是
1. 提交全部
git commit -a 
2. 如果不想提交全部,那么可以通过添加 -i 选项
git commit file/to/path -i -m "merge"
上述情况一般出现在解决本地working copy冲突时出现, 本地文件修改(手工merge)完成后,要添加并提交,使得本地版本处于clean的状态


转载于:http://blog.csdn.net/e421083458/article/details/47950641

原创粉丝点击