git - 提交空目录

需要在目录下创建 .gitkeep 文件,然后在项目的 .gitignore 中设置不忽略 .gitkeep。
.gitkeep 是一个约定俗成的文件名并不会带有特殊规则。

strong@foreverstrong:~/gogsgit_work/parking_system$ mkdir tmp
strong@foreverstrong:~/gogsgit_work/parking_system$
strong@foreverstrong:~/gogsgit_work/parking_system$ cd tmp/
strong@foreverstrong:~/gogsgit_work/parking_system/tmp$ ls
strong@foreverstrong:~/gogsgit_work/parking_system/tmp$
strong@foreverstrong:~/gogsgit_work/parking_system/tmp$ touch .gitkeep
strong@foreverstrong:~/gogsgit_work/parking_system/tmp$
strong@foreverstrong:~/gogsgit_work/parking_system/tmp$ ll
total 8
drwxrwxr-x 2 strong strong 4096 Jun 27 17:08 ./
drwxrwxr-x 8 strong strong 4096 Jun 27 17:07 ../
-rw-rw-r-- 1 strong strong    0 Jun 27 17:08 .gitkeep
strong@foreverstrong:~/gogsgit_work/parking_system/tmp$ cd ..
strong@foreverstrong:~/gogsgit_work/parking_system$
strong@foreverstrong:~/gogsgit_work/parking_system$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:(use "git add <file>..." to include in what will be committed)tmp/nothing added to commit but untracked files present (use "git add" to track)
strong@foreverstrong:~/gogsgit_work/parking_system$
strong@foreverstrong:~/gogsgit_work/parking_system$ git add .
strong@foreverstrong:~/gogsgit_work/parking_system$
strong@foreverstrong:~/gogsgit_work/parking_system$ git commit -m "add tmp"
strong@foreverstrong:~/gogsgit_work/parking_system$ git push

git - 提交空目录相关推荐

  1. git提交空目录的方法

    git管理文件的方式与cvs和svn等不同,git只关注文件的变动,不单独关注目录变动.所以通常情况下,空目录是无法提交到git仓库的.但是由于一些实际的情况,我们需要空目录的存在. 那如何提交空目录 ...

  2. git中如何提交空目录

    希望从git仓库中拉取代码时目录就已经存在了,不需要再手动创建,但是git并不允许git提交空目录,应该怎么办呢? 其实这里有两种情况: 目录是空的 这种情况下只需要在目录下创建.gitkeep文件, ...

  3. 【Git的学习笔记】老板让我用Git提交,但我还没学过Git

    Git 分布式版本控制工具 文章目录 Git 分布式版本控制工具 1.目标 2.概述 2.1.开发中的实际场景 2.2 版本控制的方式 2.3 SVN 2.4 Git 2.5 Git工作流程图 3. ...

  4. git 提交 全部文件

    原文:https://www.cnblogs.com/smuxiaolei/p/7484678.html git add .  git add xx命令可以将xx文件添加到暂存区,如果有很多改动可以通 ...

  5. atom 中首次使用git_使用Atom获得更好的Git提交消息

    atom 中首次使用git by Hasit Mistry 通过Hasit Mistry 使用Atom获得更好的Git提交消息 (Get Better Git Commit Messages with ...

  6. Git提交到多个远程仓库(多看两个文档)

    Git提交到多个远程仓库(多看两个文档) 一.总结 一句话总结: 二. Git提交到多个远程仓库(多看两个文档) 有两种做法,先看第一种 一.通过命令行进行操作 例如我有下面两个仓库: Mybatis ...

  7. Git提交时提示‘The file will have its original line endings in your working directory’

    Git提交时提示'The file will have its original line endings in your working directory' Git出现错误 git add -A ...

  8. mac电脑Git提交代码到Github提示git-credential-osxkeychain 验证解决方案

    mac电脑Git提交代码到Github提示git-credential-osxkeychain 验证解决方案 参考文章: (1)mac电脑Git提交代码到Github提示git-credential- ...

  9. 使用git提交到github,每次都要输入用户名和密码的解决方法

    使用git提交到github,每次都要输入用户名和密码的解决方法 参考文章: (1)使用git提交到github,每次都要输入用户名和密码的解决方法 (2)https://www.cnblogs.co ...

最新文章

  1. 【物理方程】物理学中最难的方程之一,你知道多少?
  2. shell 中 if then语句中会跟着-ne -ge之类的参数的含义
  3. 常见多媒体文件格式及视音频编解码总结
  4. C语言malloc和calloc的区别
  5. Fedora安装Mariadb数据库
  6. 答案对程序不对matlab,程序结果不对
  7. mysql 所有外键_mysql中的外键
  8. 论文赏析[NAACL16]RNN文法
  9. 一、Java多线程基础
  10. labview rtm_下载Vista RTM
  11. 威纶触摸屏如何组态设置离散量报警及报警历史记录?
  12. 电脑显示网络计算机和设备不可见,win10系统网络发现已关闭看不到网络计算机和设备的解决方法...
  13. base scroll横向滚动_微信小程序实践:2.3 可滚动的容器组件之 scroll-view
  14. monkey命令——压力测试——转载参考01
  15. 服务器修复oxc0000098,修复oxc0000098的方法
  16. 基于词汇衔接的文档级扩展机器翻译评测指标
  17. 微信昵称中表情保存到数据库问题
  18. C语言-己有变量定义和西数调用语句,输入字符型a ,整型n 利用函数调用语句mypow(a,n);用来求a的n次方
  19. matlab 计算两个函数的卷积
  20. 快速上手@Aspect+@Pointcut

热门文章

  1. MediaPlayer与SoundPooly优劣分析
  2. php查询替换_如何在PHP中使用正则表达式进行查找替换
  3. python 70行完成requests抓取csdn阅读量.
  4. 网易折射出商业模式多棱镜:互联网进入Hard模式
  5. AquaMoon and Strange Sort CodeForces - 1546C(思维)
  6. Nginx实现URL路径转接
  7. 成都微信小程序电商定制报价
  8. Windows系统下将MAC系统的可执行dmg文件转换为ISO文件 安装到虚拟机的MAC系统上
  9. BUUCTF:秘密文件
  10. 从PayPal提现到香港招行一卡通港币,再兑换为内地招行一卡通人民币