一、本地文件删除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