git管理项目疑难

一、本地文件删除git checkout 无法恢复

git reset --hard HEAD
git checkout 

二、恢复到某一次commit

git reset [commit 哈希值]

三、出现无法创建分支错误,提示如下

对象计数中: 586, 完成.
Delta compression using up to 4 threads.
压缩对象中: 100% (474/474), 完成.
写入对象中: 100% (586/586), 28.40 MiB | 2.11 MiB/s, 完成.
Total 586 (delta 292), reused 147 (delta 48)
remote: fatal: Out of memory, malloc failed (tried to allocate 477012136 bytes)
error: unpack failed: index-pack abnormal exit
To http://xxxxxxxx/xxx/xxx.git
 ! [remote rejected] trunk -> trunk (unpacker error)
error: 无法推送一些引用到 'http://xxxxxxxxx/xxx/xxx.git'


解决方法是,增加系统swap空间!

sudo dd if=/dev/zero of=swap.disk bs=1M count=2k #(创建2G的swap, 这步比较慢) 
sudo mkswap -f swap.disk 
sudo swapon /host/ubuntu/disks/swap.disk

参考链接:

http://forum.ubuntu.org.cn/viewtopic.php?f=48&p=1637212


四、记住用户名密码

git config --global credential.helper store

五、gitignore在eclipse中的配置

# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Eclipse project files
.classpath
.project
.DS_Store





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值