Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我
所有文章 外链

Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我

git学习之二-git基础

阅读数:次 2016-09-05
字数统计: 373字   |   阅读时长≈ 1分

取得项目git仓库
在现存的目录下,通过导入所有文件来创建新的 Git 仓库。
初始化

1
2
3
$ git init
#末尾自定义项目目录名称mygrit
$ git clone git://github.com/schacon/grit.git mygrit

文件状态变化周期:
文件状态变化周期

检查当前文件状态:

1
$ git status

跟踪新文件

1
2
3
4
5
6
$ git add filename
$ git status
# On branch master
# Changes to be committed:
# (use "git reset ..." to unstage)
# new file: README

忽略某些文件:

1
2
3
4
5
6
7
8
#养成一开始就设置好.gitignore文件的习惯,免得将无用文件或者机密文件上传。
**.gitignore文件**
# 此为注释 – 将被 Git 忽略
*.a # 忽略所有 .a 结尾的文件
!lib.a # 但 lib.a 除外
/TODO # 仅仅忽略项目根目录下的 TODO 文件,不包括 subdir/TODO
build/ # 忽略 build/ 目录下的所有文件
doc/*.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt

提交更新:

1
2
3
4
##打开文本编辑器输入提交说明
$ git commit
##配置编辑器
$ git config --global core.editor

跳过使用暂存区域:

1
2
#加上 -a 则自动将所有已跟踪过的文件暂存起来一并提交
$ git commit -a -m 'added new file'

移除文件:

1
2
$ rm file
$ git rm file

移动文件:

1
2
3
4
5
6
# 相当于改名操作
$ git mv file_from file_to
#上面一条命令相当于下面三条命令
$ mv file_from file_to
$ git rm file_from
$ git add file_to

查看提交历史:

1
$ git log 

从已有的 Git 仓库克隆出一个新的镜像仓库来。

1
$ git clone xxx.git
  • 本文作者: Linking
  • 本文链接: https://linking.fun/2016/09/05/git学习之二-git基础/
  • 版权声明: 版权所有,转载请注明出处!
  • git
  • cs

扫一扫,分享到微信

git学习之三-最近遇到的坑
一台机器部署多个Tomcat及如何忽略webapps里的项目
目录,不存在的…
© 2015-2026 Linking
GitHub:hexo-theme-yilia-plus by Litten
本站总访问量次 | 本站访客数人
  • 所有文章
  • 外链

tag:

  • weather
  • 需求
  • essay
  • basketball
  • olympic
  • nginx
  • APPScan
  • SQl盲注
  • xss
  • Ajax
  • ajax
  • ai
  • agent
  • openclaw
  • ccf
  • Nginx
  • HTML5
  • html5
  • hmtl5
  • sse
  • JavaScriptCore
  • Oracle
  • operation
  • Linux
  • deploy
  • Mac Office
  • markdown
  • ListView
  • GridView
  • MySQL
  • 慢查询
  • mongodb
  • 转置
  • thought
  • network
  • ubuntu
  • NetworkManager
  • RFKill
  • Netplan
  • avatar
  • cocoa
  • blog
  • Gitalk
  • container
  • macvlan
  • docker
  • oracle
  • cookie
  • patch
  • gitea
  • git
  • iOS
  • https
  • 多线程
  • bundle
  • 兼容性
  • HTTP
  • 绘图
  • cs
  • java
  • 效率
  • 快捷键
  • route
  • nodejs
  • pip
  • arcgis
  • arcgis 建模
  • 标识
  • redis
  • read
  • bookList
  • running
  • showdoc
  • disk
  • unit-test
  • D.Wade
  • thoughts
  • duoduo
  • Python
  • python
  • tomcat
  • 读书节
  • session
  • jdk
  • war
  • 加班
  • Android onclick事件监听
  • 正则
  • 手机品牌匹配
  • ntp
  • OpenLayers
  • Geoserver
  • wechat
  • 微信公众号
  • 爬虫
  • WeChat
  • 张靓颖
  • 动漫
  • vpn
  • PPT
  • MarkDown
  • plan
  • 朱赟
  • 极客时间专栏
  • 极客邦
  • 模块化
  • MVC
  • excel
  • NBA
  • kobe
  • team
  • crawler
  • 进度条
  • ssl
  • book
  • anti-stealing-link
  • Agentic Engineering
  • Vibe Coding
  • Software 3.0
  • Andrej Karpathy
  • LLM
  • Programming
  • complain

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • GitHub Trending
  • OpenAI ChatGPT
  • Gitee码云
  • 简书
  • CSDN