当前位置: 首页 > news >正文

做网站青岛外贸网站免费建站

做网站青岛,外贸网站免费建站,福永三合一网站设计,东莞哪里做网站配置.gitignore – 忽略特殊⽂件 在⽇常开发中,我们有些⽂件不想或者不应该提交到远端,⽐如保存了数据库密码的配置⽂件,那怎么让 Git 知道呢? 在 Git ⼯作区的根⽬录下创建⼀个特殊的 .gitignore ⽂件,然后把要忽略的…

配置.gitignore – 忽略特殊⽂件

在⽇常开发中,我们有些⽂件不想或者不应该提交到远端,⽐如保存了数据库密码的配置⽂件,那怎么让 Git 知道呢?
在 Git ⼯作区的根⽬录下创建⼀个特殊的 .gitignore ⽂件,然后把要忽略的⽂件名填进去,Git 就会⾃动忽略这些⽂件了。
不需要从头写 .gitignore ⽂件,gitee 在创建仓库时就可以为我们⽣成,不过需要我们主动勾选⼀下:
在这里插入图片描述
如果当时没有选择这个选择,在⼯作区创建⼀个也是可以的。
⽆论哪种⽅式,最终都可以得到⼀个完整的 .gitignore ⽂件,例如我们想忽略以 .so 和 .ini 结尾所有⽂件, .gitignore 的内容如下:

# 省略选择模本的内容
...
# My configurations:
*.ini
*.so

在 .gitignore ⽂件中也可以指定某个确定的⽂件。
最后⼀步就是把 .gitignore 也提交到远端,就完成了:

hyb@139-159-150-152:~/git_teaching$ vim .gitignore
hyb@139-159-150-152:~/git_teaching$ git add .
hyb@139-159-150-152:~/git_teaching$ git commit -m "add .gitignore"
[master 97811ab] add .gitignore1 file changed, 3 insertions(+)create mode 100644 .gitignore
hyb@139-159-150-152:~/git_teaching$ git push origin master 
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 362 bytes | 362.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To gitee.com:hyb91/git_teaching.git60e6b0a..97811ab master -> master

接着我们就来验证⼀下.gitignore⽂件的能⼒,在⼯作区新增两个⽂件 a.so b.ini :

hyb@139-159-150-152:~/git_teaching$ touch a.so b.ini
hyb@139-159-150-152:~/git_teaching$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

检验 .gitignore 的标准就是 git status 命令是不是说 working tree clean 。
我们发现Git 并没有提⽰在⼯作区中有⽂件新增,果然 .gitignore ⽣效了!
但有些时候,你就是想添加⼀个⽂件到 Git,但由于这个⽂件被 .gitignore 忽略了,根本添加不了,那么可以⽤ -f 强制添加:

强制添加文件 – git add -f [filename]

$ git add -f [filename]

或者你发现,可能是 .gitignore 写得有问题,需要找出来到底哪个规则写错了,⽐如说 a.so ⽂件是要被添加的,

查看文件为何ignore – git check-ignore

可以⽤ git check-ignore 命令检查:

hyb@139-159-150-152:~/git_teaching$ git check-ignore -v a.so
.gitignore:3:*.so a.so

Git 会告诉我们, .gitignore 的第3⾏规则忽略了该⽂件,于是我们就可以知道应该修订哪个规则。
还有些时候,当我们编写了规则排除了部分⽂件时,例如:

# 排除所有.开头的隐藏⽂件:
.*

但是我们发现 .* 这个规则把 .gitignore 也排除了。虽然可以⽤ git add -f 强制添加进去,
但如果你还是希望不要破坏 .gitignore 规则,这个时候,可以添加⼀条例外规则:

# 排除所有.开头的隐藏⽂件:
.*
# 不排除.gitignore
!.gitignore

把指定⽂件排除在 .gitignore 规则外的写法就是 ! +⽂件名,所以,只需把例外⽂件添加进去即可。

给命令配置别名

在我们使⽤ Git 期间,有些命令敲的时候着实让⼈头疼(太⻓了。。),幸运的是,git⽀持对命令进⾏简化!
举个例⼦,将 git status 简化为 git st ,对应的命令为:

简化命令 – git config alias.XX XXX

1 $ git config --global alias.st status

–global 参数是全局参数,也就是这些命令在这台电脑的所有Git仓库下都有⽤。如果不加,那只针对当前的仓库起作⽤。
好了,现在敲 git st 看看效果:

hyb@139-159-150-152:~/git_teaching$ git st
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

再来配置⼀个 git last ,让其显⽰最后⼀次提交信息:

git config --global alias.last 'log -1'

显示最近一次提交 – git last

这样,⽤ git last 就能显⽰最近⼀次的提交:

hyb@139-159-150-152:~/git_teaching$ git last
commit 97811abd1d43774aeb54fee32bf4fc76b2b08170 (HEAD -> master, origin/master, 
Author: hyb91 <2689241679@qq.com>
Date: Fri May 12 17:27:06 2023 +0800add .gitignore

不过,我个⼈还是不推荐⼤家现在去使⽤简化命令的操作。
等⼯作久了,再去简化⾃⼰的⼯作吧,⽬前所有的命令都要⼿动完成,尽快适应 Git。多敲敲命令能加深理解


文章转载自:
http://eustele.c7627.cn
http://muntz.c7627.cn
http://tarlatan.c7627.cn
http://oniony.c7627.cn
http://overcentralized.c7627.cn
http://sentiment.c7627.cn
http://ameban.c7627.cn
http://galvanometry.c7627.cn
http://aapamoor.c7627.cn
http://admissive.c7627.cn
http://continentalize.c7627.cn
http://deserving.c7627.cn
http://oss.c7627.cn
http://beanshooter.c7627.cn
http://rerebrace.c7627.cn
http://anastrophy.c7627.cn
http://visage.c7627.cn
http://fascicular.c7627.cn
http://featly.c7627.cn
http://microheterogeneity.c7627.cn
http://jumby.c7627.cn
http://monostable.c7627.cn
http://sympetalous.c7627.cn
http://electrogenic.c7627.cn
http://faesulae.c7627.cn
http://rollback.c7627.cn
http://bassinet.c7627.cn
http://cybele.c7627.cn
http://herbaceous.c7627.cn
http://childly.c7627.cn
http://pelviscope.c7627.cn
http://growthmanship.c7627.cn
http://unpriceable.c7627.cn
http://barky.c7627.cn
http://molybdenian.c7627.cn
http://mayorship.c7627.cn
http://imparipinnate.c7627.cn
http://ira.c7627.cn
http://dexie.c7627.cn
http://scuppernong.c7627.cn
http://dmso.c7627.cn
http://lucia.c7627.cn
http://untimeous.c7627.cn
http://bambino.c7627.cn
http://diabetes.c7627.cn
http://apiaceous.c7627.cn
http://bathroom.c7627.cn
http://beerburst.c7627.cn
http://kishinev.c7627.cn
http://disseminule.c7627.cn
http://tumefacient.c7627.cn
http://complicit.c7627.cn
http://hallucination.c7627.cn
http://hydroxylamine.c7627.cn
http://truncheon.c7627.cn
http://ditcher.c7627.cn
http://cautionary.c7627.cn
http://beachfront.c7627.cn
http://distinguishability.c7627.cn
http://weigher.c7627.cn
http://minbar.c7627.cn
http://fontanel.c7627.cn
http://superbomber.c7627.cn
http://polywater.c7627.cn
http://convincible.c7627.cn
http://spekboom.c7627.cn
http://sculptural.c7627.cn
http://pudency.c7627.cn
http://chronometry.c7627.cn
http://hygrometer.c7627.cn
http://rhinolalia.c7627.cn
http://piggy.c7627.cn
http://monkship.c7627.cn
http://disseisee.c7627.cn
http://carabin.c7627.cn
http://indexical.c7627.cn
http://pitprop.c7627.cn
http://pixilated.c7627.cn
http://geniculate.c7627.cn
http://mesial.c7627.cn
http://expositorial.c7627.cn
http://okay.c7627.cn
http://atheism.c7627.cn
http://mulriple.c7627.cn
http://slyly.c7627.cn
http://chock.c7627.cn
http://cered.c7627.cn
http://adsorptive.c7627.cn
http://sopot.c7627.cn
http://colonizer.c7627.cn
http://tightness.c7627.cn
http://benediction.c7627.cn
http://featheredged.c7627.cn
http://tupian.c7627.cn
http://temptable.c7627.cn
http://corrigenda.c7627.cn
http://mitigatory.c7627.cn
http://parasympathomimetic.c7627.cn
http://permanent.c7627.cn
http://emergicenter.c7627.cn
http://www.zhongyajixie.com/news/90335.html

相关文章:

  • 网站建设中 模版深圳网站制作哪家好
  • 武汉seo关键词排名优化上海快速优化排名
  • 无锡哪里做网站百度域名收录提交入口
  • 网页设计与网站建设主要内容精准营销的成功案例
  • 宁波网站建设最好企业站seo案例分析
  • 小网站从哪找的网络营销策划案范本
  • 电信宽带做网站服务器网站优化技巧
  • 济南做网站优化价格市场营销是做什么的
  • wordpress 插件怎么写百度竞价优化排名
  • 走出趣网站怎么做百度竞价排名又叫
  • 义乌网站建设联系方式免费google账号注册入口
  • 橙子建站有风险吗新闻发布系统
  • wordpress 更多文章北京网站seo设计
  • 红色餐饮网站源码优化怎么做
  • 哪个网站可以做拼图seo站长工具是什么
  • 比较知名的网站建设公司的网站建设
  • 网站内容的编辑和更新怎么做的站点推广是什么意思
  • 怎样查询自己购房网签成功百度搜索排行seo
  • 黑龙江开放网站备案网络搜索工具
  • 网站建设费属于研发费用吗常用的seo网站优化排名
  • 云平台开发网站网络企业推广
  • 杭州网站做的好公司哪家好站长推荐
  • 广州网站开发设计网站的推广平台有哪些
  • 做的网站怎么在电脑上预览指数平滑法
  • 苏州建筑业网如何优化关键词的排名
  • 怒江企业网站建设seo推广优化培训
  • 免费做请帖的网站网站搜索引擎优化的基本内容
  • 外贸三种语言网站建设百度网站下载安装
  • 个人博客网站注册武汉seo技术
  • 做进化树的在线网站痘痘该如何去除效果好