标签:Git

  • SVN 仓库完美迁移到 Git 的方法

    18-04-29 14:42 21291 0 技术

    使用 git svn clone 命令拷贝 svn 仓库

    cd ~
    mkdir temp
    git svn clone url/to/svn/repo/ -T trunk -b branches -t tags
    

    svn 的 url 不要加 trunk ,否则不能迁移 branches 和 tags

    新建 git 的裸仓库

    cd ~
    mkdir temp.git
    cd temp.git
    git init --bare
    

    将 git 的 master 和 svn 的 trunk 分支对应

    git symbolic-ref HEAD refs/heads/trunk
    
  • Git 配置全局忽略文件

    16-02-26 15:02 24269 0 未分类

    创建 ~/.gitignore 文件,把需要全局忽略的文件类型塞到这个文件里。

    # .gitignore_global
    ####################################
    ######## OS generated files ########
    ####################################
    .DS_Store
    .DS_Store?
    *.swp
    ._*
    .Spotlight-V100
    .Trashes
    Icon?
    ehthumbs.db
    Thumbs.db
    ####################################
    ############# packages #############
    ####################################
    *.7z
    *.dmg
    *.gz
    *.iso
    *.jar
    *.rar
    *.tar
    *.zip
    

    ~/.gitconfig 中引入刚创建的 .gitignore

    git config --global core.excludesfile ~/.gitignore
    
  • .gitignore 添加后无效的解决办法

    14-01-18 20:30 22703 0 技术

    我们在项目中经常会出现 .gitignore 修改后并没有忽略掉我们已经添加的文件,那是因为 .gitignore 对已经追踪 (track) 的文件是无效的,需要清除缓存,清除缓存后文件将以未追踪的形式出现,这时重新添加 (add) 并提交 (commit) 就可以了。

    // 不要忘了后面的 . 
    git rm -r --cached .
    git add .
    git commit -m "comment"
    

文章归档

文章日历

2024 年 04 月
29 01 02 03 04 05 06
07 08 09 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
29 30 01 02 03 04 05

文章标签

最新评论

友情链接