博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Git的使用的简单介绍
阅读量:4698 次
发布时间:2019-06-09

本文共 704 字,大约阅读时间需要 2 分钟。

节选自:

git是一个分布式的引擎,相当于在本地有一个服务器,你先把你的改动commit到本地的,

然后再push到主服务器上。
同时如果你想要更新,则需要先在本地commit,然后再去pull.

创建仓库

mkdir learngit
git init
添加文件到git仓库
cd learngit
echo "git is a version control system, and it is created by Linux , it is free software" >>ReadMe.txt
git add ReadMe.txt
提交到本地服务器:
git commit -m "wrote a readme file"
查看当前的状态,仓库里的文件是否有被修改过?
git status
查看文件的具体改动:
git diff ReadMe.txt
提交变更的文件和提交新文件是一样的,也是需要两步,
一步是git add ReadMe.txt
第二步是 git commit -m "update Readme.txt 's content"

git log 查看提交的日志记录

回到历史版本:
    HEAD指向的版本就是当前版本,因此,Git允许我们在版本的历史之间穿梭,使用命令git reset --hard commit_id。
    穿梭前,用git log可以查看提交历史,以便确定要回退到哪个版本。
    要重返未来,用git reflog查看命令历史,以便确定要回到未来的哪个版本。

转载于:https://www.cnblogs.com/huaxiaoyao/p/5369884.html

你可能感兴趣的文章
CF787D Legacy
查看>>
CF1175F The Number of Subpermutations
查看>>
CF1208F Bits And Pieces
查看>>
CF1208C Magic Grid
查看>>
CF1208D Restore Permutation
查看>>
CF1172B Nauuo and Circle
查看>>
CF1178D Prime Graph
查看>>
CF1190D Tokitsukaze and Strange Rectangle
查看>>
CF1202F You Are Given Some Letters...
查看>>
CF1179C Serge and Dining Room
查看>>
CF1168B Good Triple
查看>>
CF1208E Let Them Slide
查看>>
AT2000 Leftmost Ball
查看>>
CF1086E Beautiful Matrix
查看>>
在单位上班的25条建议(建议收藏)
查看>>
web前端--http协议
查看>>
idea选中文件时左侧菜单自动定位到文件所在位置
查看>>
idea导入eclipse项目并运行
查看>>
类加载器
查看>>
动态代理
查看>>