Skip to content
Menu
(◍ ´꒳` ◍)

  • Blog
  • Front Page
(◍ ´꒳` ◍)

git使用流程套路

By erhu on 2023年8月31日2023年8月31日
  1. git init . 初始化本地仓库
  2. 写代码,如 hello.sh
  3. 通过git add . 进行本地文件追踪管理,文件信息被记录到 暂存区
  4. git commit -m ‘注释’ ,将暂存区的数据,提交到local repo 本地仓库,进行第一个版本的记录

[root@web-7 ~/git-learn/my_shell]#pwd
/root/git-learn/my_shell
[root@web-7 ~/git-learn/my_shell]#
[root@web-7 ~/git-learn/my_shell]#ls
hello.sh
[root@web-7 ~/git-learn/my_shell]#
[root@web-7 ~/git-learn/my_shell]#
[root@web-7 ~/git-learn/my_shell]#ls -a
. .. hello.sh

没有被git进行管理

使用git进行,从0 到1管理

  1. 初始化生成 .git文件夹
    [root@web-7 ~/git-learn/my_shell]#git init .
    初始化了一个空的git仓库 再 /root/git-learn/my_shell/.git/
    Initialized empty Git repository in /root/git-learn/my_shell/.git/

查看这个.git本地仓库的文件夹,有什么内容
[root@web-7 ~/git-learn/my_shell]#ls .git
branches config description HEAD hooks info objects refs

这个时候,/root/git-learn/my_shell
该文件夹,就被git管理了
再这个目录下对文件的修改类操作,就会被git进行记录了

命令,查看git工作区的状态

[root@web-7 ~/git-learn/my_shell]#git status

On branch master

#

Initial commit

#

Untracked files:

(use “git add …” to include in what will be committed)

#

hello.sh

nothing added to commit but untracked files present (use “git add” to track)

追踪文件属性
[root@web-7 ~/git-learn/my_shell]#git add hello.sh
[root@web-7 ~/git-learn/my_shell]#
[root@web-7 ~/git-learn/my_shell]#
[root@web-7 ~/git-learn/my_shell]#
[root@web-7 ~/git-learn/my_shell]#git status

On branch master

#

Initial commit

#

Changes to be committed:

(use “git rm –cached …” to unstage)

#

new file: hello.sh

#

提交版本了,提交第一个版本

[root@web-7 ~/git-learn/my_shell]#git commit -m ‘v1 第一次提交’
[master (root-commit) 67d8f28] v1 第一次提交
1 file changed, 1 insertion(+)
create mode 100644 hello.sh

此时再用git status查看工作区的状态是如何
此时工作区就很干净了,需要提交的代码,没了

[root@web-7 ~/git-learn/my_shell]#git status

On branch master

nothing to commit, working directory clean

Category: 鸿蒙

文章导航

mysql02
git

Related Posts

承认平庸-iptables规则部署-处理动作2-14

3月 2, 2023
Read More

承认平庸-打印机维修01

3月 6, 2023
Read More

k8s-k8s-up&Running20

4月 17, 2023
Read More

发表回复 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

近期文章

  • 实施002
  • 实施SQL001
  • 泛微oa001-字段
  • 硬件前端-海康威视摄像头
  • 使用Docker搭建Weblogic服务001

近期评论

    归档

    • 2023年10月
    • 2023年9月
    • 2023年8月
    • 2023年5月
    • 2023年4月
    • 2023年3月
    • 2021年11月
    • 2021年10月
    • 2021年9月
    • 2021年8月
    • 2021年5月

    分类

    • C
    • docker
    • iptable
    • ISIS
    • java
    • k8s
    • liunx
    • OpenCV py
    • ospf
    • solr
    • zabbix
    • 劳动法
    • 周杰伦
    • 格林法则
    • 等保
    • 鸿蒙

    其他操作

    • 登录
    • 条目feed
    • 评论feed
    • WordPress.org
    ©2025 (◍ ´꒳` ◍) | WordPress Theme by Superb WordPress Themes