文本格式转换
手动完成 dos 文本格式到 UNIX 文本格式的转换
# from unix to dos
sed -e 's/$/\r/' txt_in_unix.txt > txt_in_dos.txt
# from dos to unix
sed -e 's/.$//' txt_in_dos.txt > txt_in_unix.txt
tr -d '\r' < txt_in_dos.txt > txt_in_unix.txt
Git维护
# 压缩历史信息节省磁盘及内存空间
# 对于大的仓库来说,此操作比较耗时,建议在空闲时进行
$ git gc
# git仓库的一致性检查, 通常会提示“悬空对象"(dangling object),这并非问题。
# 有时候它们是找回丢失的工作的最后一丝希望
$ git fsck
Git迁移
# 复制 git 裸仓库
$ git clone --bare /home/user/myrepo/.git /tmp/myrepo.git
# 通过scp命令,复制到新的目标服务器
$ scp -r /tmp/myrepo.git myserver.com:/opt/git/myrepo.git
# 现在,可以通过git 从新的服务器上clone代码了
$ git clone myserver.com:/opt/git/myrepo.git